<!DOCTYPE html>
<html lang="en-US">
<head>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="language" content="en" />
        <link href="./assets/ffd55088/css/bootstrap.css" rel="stylesheet">
<link href="./assets/5cf9384a/solarized_light.css" rel="stylesheet">
<link href="./assets/6c54116e/style.css" rel="stylesheet">
<script src="./assets/a44cef0f/jquery.js"></script>
<script src="./assets/ffd55088/js/bootstrap.js"></script>
<script src="./assets/8ac4e28a/jssearch.js"></script>    <title>Connection, yii\db\Connection - Yii Framework 2.0 API Documentation</title>
</head>
<body>

<div class="wrap">
    <nav id="w9381" class="navbar-inverse navbar-fixed-top navbar" role="navigation"><div class="navbar-header"><button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#w9381-collapse"><span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span></button><a class="navbar-brand" href="./index.html">Yii Framework 2.0 API Documentation</a></div><div id="w9381-collapse" class="collapse navbar-collapse"><ul id="w9382" class="navbar-nav nav"><li><a href="./index.html">Class reference</a></li>
<li class="dropdown"><a class="dropdown-toggle" href="#" data-toggle="dropdown">Extensions <b class="caret"></b></a><ul id="w9383" class="dropdown-menu"><li><a href="./ext-apidoc-index.html" tabindex="-1">apidoc</a></li>
<li><a href="./ext-authclient-index.html" tabindex="-1">authclient</a></li>
<li><a href="./ext-bootstrap-index.html" tabindex="-1">bootstrap</a></li>
<li><a href="./ext-codeception-index.html" tabindex="-1">codeception</a></li>
<li><a href="./ext-debug-index.html" tabindex="-1">debug</a></li>
<li><a href="./ext-elasticsearch-index.html" tabindex="-1">elasticsearch</a></li>
<li><a href="./ext-faker-index.html" tabindex="-1">faker</a></li>
<li><a href="./ext-gii-index.html" tabindex="-1">gii</a></li>
<li><a href="./ext-imagine-index.html" tabindex="-1">imagine</a></li>
<li><a href="./ext-jui-index.html" tabindex="-1">jui</a></li>
<li><a href="./ext-mongodb-index.html" tabindex="-1">mongodb</a></li>
<li><a href="./ext-redis-index.html" tabindex="-1">redis</a></li>
<li><a href="./ext-smarty-index.html" tabindex="-1">smarty</a></li>
<li><a href="./ext-sphinx-index.html" tabindex="-1">sphinx</a></li>
<li><a href="./ext-swiftmailer-index.html" tabindex="-1">swiftmailer</a></li>
<li><a href="./ext-twig-index.html" tabindex="-1">twig</a></li></ul></li>
<li><a href="./guide-README.html">Guide</a></li></ul><div class="navbar-form navbar-left" role="search">
  <div class="form-group">
    <input id="searchbox" type="text" class="form-control" placeholder="Search">
  </div>
</div>
</div></nav>
    <div id="search-resultbox" style="display: none;" class="modal-content">
        <ul id="search-results">
        </ul>
    </div>

    
<div class="row">
    <div class="col-md-3">
                <div id="navigation" class="list-group"><a class="list-group-item" href="#navigation-9350" data-toggle="collapse" data-parent="#navigation">Not namespaced classes <b class="caret"></b></a><div id="navigation-9350" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii.html">Yii</a></div>
<a class="list-group-item" href="#navigation-9351" data-toggle="collapse" data-parent="#navigation">yii <b class="caret"></b></a><div id="navigation-9351" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-baseyii.html">BaseYii</a></div>
<a class="list-group-item" href="#navigation-9352" data-toggle="collapse" data-parent="#navigation">yii\base <b class="caret"></b></a><div id="navigation-9352" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-base-action.html">Action</a>
<a class="list-group-item" href="./yii-base-actionevent.html">ActionEvent</a>
<a class="list-group-item" href="./yii-base-actionfilter.html">ActionFilter</a>
<a class="list-group-item" href="./yii-base-application.html">Application</a>
<a class="list-group-item" href="./yii-base-arrayaccesstrait.html">ArrayAccessTrait</a>
<a class="list-group-item" href="./yii-base-arrayable.html">Arrayable</a>
<a class="list-group-item" href="./yii-base-arrayabletrait.html">ArrayableTrait</a>
<a class="list-group-item" href="./yii-base-behavior.html">Behavior</a>
<a class="list-group-item" href="./yii-base-bootstrapinterface.html">BootstrapInterface</a>
<a class="list-group-item" href="./yii-base-component.html">Component</a>
<a class="list-group-item" href="./yii-base-configurable.html">Configurable</a>
<a class="list-group-item" href="./yii-base-controller.html">Controller</a>
<a class="list-group-item" href="./yii-base-dynamicmodel.html">DynamicModel</a>
<a class="list-group-item" href="./yii-base-errorexception.html">ErrorException</a>
<a class="list-group-item" href="./yii-base-errorhandler.html">ErrorHandler</a>
<a class="list-group-item" href="./yii-base-event.html">Event</a>
<a class="list-group-item" href="./yii-base-exception.html">Exception</a>
<a class="list-group-item" href="./yii-base-exitexception.html">ExitException</a>
<a class="list-group-item" href="./yii-base-inlineaction.html">InlineAction</a>
<a class="list-group-item" href="./yii-base-invalidcallexception.html">InvalidCallException</a>
<a class="list-group-item" href="./yii-base-invalidconfigexception.html">InvalidConfigException</a>
<a class="list-group-item" href="./yii-base-invalidparamexception.html">InvalidParamException</a>
<a class="list-group-item" href="./yii-base-invalidrouteexception.html">InvalidRouteException</a>
<a class="list-group-item" href="./yii-base-invalidvalueexception.html">InvalidValueException</a>
<a class="list-group-item" href="./yii-base-model.html">Model</a>
<a class="list-group-item" href="./yii-base-modelevent.html">ModelEvent</a>
<a class="list-group-item" href="./yii-base-module.html">Module</a>
<a class="list-group-item" href="./yii-base-notsupportedexception.html">NotSupportedException</a>
<a class="list-group-item" href="./yii-base-object.html">Object</a>
<a class="list-group-item" href="./yii-base-request.html">Request</a>
<a class="list-group-item" href="./yii-base-response.html">Response</a>
<a class="list-group-item" href="./yii-base-security.html">Security</a>
<a class="list-group-item" href="./yii-base-theme.html">Theme</a>
<a class="list-group-item" href="./yii-base-unknownclassexception.html">UnknownClassException</a>
<a class="list-group-item" href="./yii-base-unknownmethodexception.html">UnknownMethodException</a>
<a class="list-group-item" href="./yii-base-unknownpropertyexception.html">UnknownPropertyException</a>
<a class="list-group-item" href="./yii-base-userexception.html">UserException</a>
<a class="list-group-item" href="./yii-base-view.html">View</a>
<a class="list-group-item" href="./yii-base-viewcontextinterface.html">ViewContextInterface</a>
<a class="list-group-item" href="./yii-base-viewevent.html">ViewEvent</a>
<a class="list-group-item" href="./yii-base-viewrenderer.html">ViewRenderer</a>
<a class="list-group-item" href="./yii-base-widget.html">Widget</a></div>
<a class="list-group-item" href="#navigation-9353" data-toggle="collapse" data-parent="#navigation">yii\behaviors <b class="caret"></b></a><div id="navigation-9353" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-behaviors-attributebehavior.html">AttributeBehavior</a>
<a class="list-group-item" href="./yii-behaviors-blameablebehavior.html">BlameableBehavior</a>
<a class="list-group-item" href="./yii-behaviors-sluggablebehavior.html">SluggableBehavior</a>
<a class="list-group-item" href="./yii-behaviors-timestampbehavior.html">TimestampBehavior</a></div>
<a class="list-group-item" href="#navigation-9354" data-toggle="collapse" data-parent="#navigation">yii\caching <b class="caret"></b></a><div id="navigation-9354" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-caching-apccache.html">ApcCache</a>
<a class="list-group-item" href="./yii-caching-arraycache.html">ArrayCache</a>
<a class="list-group-item" href="./yii-caching-cache.html">Cache</a>
<a class="list-group-item" href="./yii-caching-chaineddependency.html">ChainedDependency</a>
<a class="list-group-item" href="./yii-caching-dbcache.html">DbCache</a>
<a class="list-group-item" href="./yii-caching-dbdependency.html">DbDependency</a>
<a class="list-group-item" href="./yii-caching-dependency.html">Dependency</a>
<a class="list-group-item" href="./yii-caching-dummycache.html">DummyCache</a>
<a class="list-group-item" href="./yii-caching-expressiondependency.html">ExpressionDependency</a>
<a class="list-group-item" href="./yii-caching-filecache.html">FileCache</a>
<a class="list-group-item" href="./yii-caching-filedependency.html">FileDependency</a>
<a class="list-group-item" href="./yii-caching-memcache.html">MemCache</a>
<a class="list-group-item" href="./yii-caching-memcacheserver.html">MemCacheServer</a>
<a class="list-group-item" href="./yii-caching-tagdependency.html">TagDependency</a>
<a class="list-group-item" href="./yii-caching-wincache.html">WinCache</a>
<a class="list-group-item" href="./yii-caching-xcache.html">XCache</a>
<a class="list-group-item" href="./yii-caching-zenddatacache.html">ZendDataCache</a></div>
<a class="list-group-item" href="#navigation-9355" data-toggle="collapse" data-parent="#navigation">yii\captcha <b class="caret"></b></a><div id="navigation-9355" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-captcha-captcha.html">Captcha</a>
<a class="list-group-item" href="./yii-captcha-captchaaction.html">CaptchaAction</a>
<a class="list-group-item" href="./yii-captcha-captchaasset.html">CaptchaAsset</a>
<a class="list-group-item" href="./yii-captcha-captchavalidator.html">CaptchaValidator</a></div>
<a class="list-group-item" href="#navigation-9356" data-toggle="collapse" data-parent="#navigation">yii\console <b class="caret"></b></a><div id="navigation-9356" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-console-application.html">Application</a>
<a class="list-group-item" href="./yii-console-controller.html">Controller</a>
<a class="list-group-item" href="./yii-console-errorhandler.html">ErrorHandler</a>
<a class="list-group-item" href="./yii-console-exception.html">Exception</a>
<a class="list-group-item" href="./yii-console-markdown.html">Markdown</a>
<a class="list-group-item" href="./yii-console-request.html">Request</a>
<a class="list-group-item" href="./yii-console-response.html">Response</a></div>
<a class="list-group-item" href="#navigation-9357" data-toggle="collapse" data-parent="#navigation">yii\console\controllers <b class="caret"></b></a><div id="navigation-9357" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-console-controllers-assetcontroller.html">AssetController</a>
<a class="list-group-item" href="./yii-console-controllers-basemigratecontroller.html">BaseMigrateController</a>
<a class="list-group-item" href="./yii-console-controllers-cachecontroller.html">CacheController</a>
<a class="list-group-item" href="./yii-console-controllers-fixturecontroller.html">FixtureController</a>
<a class="list-group-item" href="./yii-console-controllers-helpcontroller.html">HelpController</a>
<a class="list-group-item" href="./yii-console-controllers-messagecontroller.html">MessageController</a>
<a class="list-group-item" href="./yii-console-controllers-migratecontroller.html">MigrateController</a>
<a class="list-group-item" href="./yii-console-controllers-servecontroller.html">ServeController</a></div>
<a class="list-group-item" href="#navigation-9358" data-toggle="collapse" data-parent="#navigation">yii\data <b class="caret"></b></a><div id="navigation-9358" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-data-activedataprovider.html">ActiveDataProvider</a>
<a class="list-group-item" href="./yii-data-arraydataprovider.html">ArrayDataProvider</a>
<a class="list-group-item" href="./yii-data-basedataprovider.html">BaseDataProvider</a>
<a class="list-group-item" href="./yii-data-dataproviderinterface.html">DataProviderInterface</a>
<a class="list-group-item" href="./yii-data-pagination.html">Pagination</a>
<a class="list-group-item" href="./yii-data-sort.html">Sort</a>
<a class="list-group-item" href="./yii-data-sqldataprovider.html">SqlDataProvider</a></div>
<a class="list-group-item active" href="#navigation-9359" data-toggle="collapse" data-parent="#navigation">yii\db <b class="caret"></b></a><div id="navigation-9359" class="submenu panel-collapse collapse in"><a class="list-group-item" href="./yii-db-activequery.html">ActiveQuery</a>
<a class="list-group-item" href="./yii-db-activequeryinterface.html">ActiveQueryInterface</a>
<a class="list-group-item" href="./yii-db-activequerytrait.html">ActiveQueryTrait</a>
<a class="list-group-item" href="./yii-db-activerecord.html">ActiveRecord</a>
<a class="list-group-item" href="./yii-db-activerecordinterface.html">ActiveRecordInterface</a>
<a class="list-group-item" href="./yii-db-activerelationtrait.html">ActiveRelationTrait</a>
<a class="list-group-item" href="./yii-db-aftersaveevent.html">AfterSaveEvent</a>
<a class="list-group-item" href="./yii-db-baseactiverecord.html">BaseActiveRecord</a>
<a class="list-group-item" href="./yii-db-batchqueryresult.html">BatchQueryResult</a>
<a class="list-group-item" href="./yii-db-columnschema.html">ColumnSchema</a>
<a class="list-group-item" href="./yii-db-columnschemabuilder.html">ColumnSchemaBuilder</a>
<a class="list-group-item" href="./yii-db-command.html">Command</a>
<a class="list-group-item active" href="./yii-db-connection.html">Connection</a>
<a class="list-group-item" href="./yii-db-datareader.html">DataReader</a>
<a class="list-group-item" href="./yii-db-exception.html">Exception</a>
<a class="list-group-item" href="./yii-db-expression.html">Expression</a>
<a class="list-group-item" href="./yii-db-integrityexception.html">IntegrityException</a>
<a class="list-group-item" href="./yii-db-migration.html">Migration</a>
<a class="list-group-item" href="./yii-db-migrationinterface.html">MigrationInterface</a>
<a class="list-group-item" href="./yii-db-query.html">Query</a>
<a class="list-group-item" href="./yii-db-querybuilder.html">QueryBuilder</a>
<a class="list-group-item" href="./yii-db-queryinterface.html">QueryInterface</a>
<a class="list-group-item" href="./yii-db-querytrait.html">QueryTrait</a>
<a class="list-group-item" href="./yii-db-schema.html">Schema</a>
<a class="list-group-item" href="./yii-db-schemabuildertrait.html">SchemaBuilderTrait</a>
<a class="list-group-item" href="./yii-db-staleobjectexception.html">StaleObjectException</a>
<a class="list-group-item" href="./yii-db-tableschema.html">TableSchema</a>
<a class="list-group-item" href="./yii-db-transaction.html">Transaction</a></div>
<a class="list-group-item" href="#navigation-9360" data-toggle="collapse" data-parent="#navigation">yii\db\cubrid <b class="caret"></b></a><div id="navigation-9360" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-db-cubrid-columnschemabuilder.html">ColumnSchemaBuilder</a>
<a class="list-group-item" href="./yii-db-cubrid-querybuilder.html">QueryBuilder</a>
<a class="list-group-item" href="./yii-db-cubrid-schema.html">Schema</a></div>
<a class="list-group-item" href="#navigation-9361" data-toggle="collapse" data-parent="#navigation">yii\db\mssql <b class="caret"></b></a><div id="navigation-9361" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-db-mssql-pdo.html">PDO</a>
<a class="list-group-item" href="./yii-db-mssql-querybuilder.html">QueryBuilder</a>
<a class="list-group-item" href="./yii-db-mssql-schema.html">Schema</a>
<a class="list-group-item" href="./yii-db-mssql-sqlsrvpdo.html">SqlsrvPDO</a>
<a class="list-group-item" href="./yii-db-mssql-tableschema.html">TableSchema</a></div>
<a class="list-group-item" href="#navigation-9362" data-toggle="collapse" data-parent="#navigation">yii\db\mysql <b class="caret"></b></a><div id="navigation-9362" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-db-mysql-columnschemabuilder.html">ColumnSchemaBuilder</a>
<a class="list-group-item" href="./yii-db-mysql-querybuilder.html">QueryBuilder</a>
<a class="list-group-item" href="./yii-db-mysql-schema.html">Schema</a></div>
<a class="list-group-item" href="#navigation-9363" data-toggle="collapse" data-parent="#navigation">yii\db\oci <b class="caret"></b></a><div id="navigation-9363" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-db-oci-columnschemabuilder.html">ColumnSchemaBuilder</a>
<a class="list-group-item" href="./yii-db-oci-querybuilder.html">QueryBuilder</a>
<a class="list-group-item" href="./yii-db-oci-schema.html">Schema</a></div>
<a class="list-group-item" href="#navigation-9364" data-toggle="collapse" data-parent="#navigation">yii\db\pgsql <b class="caret"></b></a><div id="navigation-9364" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-db-pgsql-querybuilder.html">QueryBuilder</a>
<a class="list-group-item" href="./yii-db-pgsql-schema.html">Schema</a></div>
<a class="list-group-item" href="#navigation-9365" data-toggle="collapse" data-parent="#navigation">yii\db\sqlite <b class="caret"></b></a><div id="navigation-9365" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-db-sqlite-columnschemabuilder.html">ColumnSchemaBuilder</a>
<a class="list-group-item" href="./yii-db-sqlite-querybuilder.html">QueryBuilder</a>
<a class="list-group-item" href="./yii-db-sqlite-schema.html">Schema</a></div>
<a class="list-group-item" href="#navigation-9366" data-toggle="collapse" data-parent="#navigation">yii\di <b class="caret"></b></a><div id="navigation-9366" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-di-container.html">Container</a>
<a class="list-group-item" href="./yii-di-instance.html">Instance</a>
<a class="list-group-item" href="./yii-di-notinstantiableexception.html">NotInstantiableException</a>
<a class="list-group-item" href="./yii-di-servicelocator.html">ServiceLocator</a></div>
<a class="list-group-item" href="#navigation-9367" data-toggle="collapse" data-parent="#navigation">yii\filters <b class="caret"></b></a><div id="navigation-9367" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-filters-accesscontrol.html">AccessControl</a>
<a class="list-group-item" href="./yii-filters-accessrule.html">AccessRule</a>
<a class="list-group-item" href="./yii-filters-contentnegotiator.html">ContentNegotiator</a>
<a class="list-group-item" href="./yii-filters-cors.html">Cors</a>
<a class="list-group-item" href="./yii-filters-httpcache.html">HttpCache</a>
<a class="list-group-item" href="./yii-filters-pagecache.html">PageCache</a>
<a class="list-group-item" href="./yii-filters-ratelimitinterface.html">RateLimitInterface</a>
<a class="list-group-item" href="./yii-filters-ratelimiter.html">RateLimiter</a>
<a class="list-group-item" href="./yii-filters-verbfilter.html">VerbFilter</a></div>
<a class="list-group-item" href="#navigation-9368" data-toggle="collapse" data-parent="#navigation">yii\filters\auth <b class="caret"></b></a><div id="navigation-9368" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-filters-auth-authinterface.html">AuthInterface</a>
<a class="list-group-item" href="./yii-filters-auth-authmethod.html">AuthMethod</a>
<a class="list-group-item" href="./yii-filters-auth-compositeauth.html">CompositeAuth</a>
<a class="list-group-item" href="./yii-filters-auth-httpbasicauth.html">HttpBasicAuth</a>
<a class="list-group-item" href="./yii-filters-auth-httpbearerauth.html">HttpBearerAuth</a>
<a class="list-group-item" href="./yii-filters-auth-queryparamauth.html">QueryParamAuth</a></div>
<a class="list-group-item" href="#navigation-9369" data-toggle="collapse" data-parent="#navigation">yii\grid <b class="caret"></b></a><div id="navigation-9369" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-grid-actioncolumn.html">ActionColumn</a>
<a class="list-group-item" href="./yii-grid-checkboxcolumn.html">CheckboxColumn</a>
<a class="list-group-item" href="./yii-grid-column.html">Column</a>
<a class="list-group-item" href="./yii-grid-datacolumn.html">DataColumn</a>
<a class="list-group-item" href="./yii-grid-gridview.html">GridView</a>
<a class="list-group-item" href="./yii-grid-gridviewasset.html">GridViewAsset</a>
<a class="list-group-item" href="./yii-grid-serialcolumn.html">SerialColumn</a></div>
<a class="list-group-item" href="#navigation-9370" data-toggle="collapse" data-parent="#navigation">yii\helpers <b class="caret"></b></a><div id="navigation-9370" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-helpers-arrayhelper.html">ArrayHelper</a>
<a class="list-group-item" href="./yii-helpers-basearrayhelper.html">BaseArrayHelper</a>
<a class="list-group-item" href="./yii-helpers-baseconsole.html">BaseConsole</a>
<a class="list-group-item" href="./yii-helpers-basefilehelper.html">BaseFileHelper</a>
<a class="list-group-item" href="./yii-helpers-baseformatconverter.html">BaseFormatConverter</a>
<a class="list-group-item" href="./yii-helpers-basehtml.html">BaseHtml</a>
<a class="list-group-item" href="./yii-helpers-basehtmlpurifier.html">BaseHtmlPurifier</a>
<a class="list-group-item" href="./yii-helpers-baseinflector.html">BaseInflector</a>
<a class="list-group-item" href="./yii-helpers-basejson.html">BaseJson</a>
<a class="list-group-item" href="./yii-helpers-basemarkdown.html">BaseMarkdown</a>
<a class="list-group-item" href="./yii-helpers-basestringhelper.html">BaseStringHelper</a>
<a class="list-group-item" href="./yii-helpers-baseurl.html">BaseUrl</a>
<a class="list-group-item" href="./yii-helpers-basevardumper.html">BaseVarDumper</a>
<a class="list-group-item" href="./yii-helpers-console.html">Console</a>
<a class="list-group-item" href="./yii-helpers-filehelper.html">FileHelper</a>
<a class="list-group-item" href="./yii-helpers-formatconverter.html">FormatConverter</a>
<a class="list-group-item" href="./yii-helpers-html.html">Html</a>
<a class="list-group-item" href="./yii-helpers-htmlpurifier.html">HtmlPurifier</a>
<a class="list-group-item" href="./yii-helpers-inflector.html">Inflector</a>
<a class="list-group-item" href="./yii-helpers-json.html">Json</a>
<a class="list-group-item" href="./yii-helpers-markdown.html">Markdown</a>
<a class="list-group-item" href="./yii-helpers-stringhelper.html">StringHelper</a>
<a class="list-group-item" href="./yii-helpers-url.html">Url</a>
<a class="list-group-item" href="./yii-helpers-vardumper.html">VarDumper</a></div>
<a class="list-group-item" href="#navigation-9371" data-toggle="collapse" data-parent="#navigation">yii\i18n <b class="caret"></b></a><div id="navigation-9371" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-i18n-dbmessagesource.html">DbMessageSource</a>
<a class="list-group-item" href="./yii-i18n-formatter.html">Formatter</a>
<a class="list-group-item" href="./yii-i18n-gettextfile.html">GettextFile</a>
<a class="list-group-item" href="./yii-i18n-gettextmessagesource.html">GettextMessageSource</a>
<a class="list-group-item" href="./yii-i18n-gettextmofile.html">GettextMoFile</a>
<a class="list-group-item" href="./yii-i18n-gettextpofile.html">GettextPoFile</a>
<a class="list-group-item" href="./yii-i18n-i18n.html">I18N</a>
<a class="list-group-item" href="./yii-i18n-messageformatter.html">MessageFormatter</a>
<a class="list-group-item" href="./yii-i18n-messagesource.html">MessageSource</a>
<a class="list-group-item" href="./yii-i18n-missingtranslationevent.html">MissingTranslationEvent</a>
<a class="list-group-item" href="./yii-i18n-phpmessagesource.html">PhpMessageSource</a></div>
<a class="list-group-item" href="#navigation-9372" data-toggle="collapse" data-parent="#navigation">yii\log <b class="caret"></b></a><div id="navigation-9372" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-log-dbtarget.html">DbTarget</a>
<a class="list-group-item" href="./yii-log-dispatcher.html">Dispatcher</a>
<a class="list-group-item" href="./yii-log-emailtarget.html">EmailTarget</a>
<a class="list-group-item" href="./yii-log-filetarget.html">FileTarget</a>
<a class="list-group-item" href="./yii-log-logger.html">Logger</a>
<a class="list-group-item" href="./yii-log-syslogtarget.html">SyslogTarget</a>
<a class="list-group-item" href="./yii-log-target.html">Target</a></div>
<a class="list-group-item" href="#navigation-9373" data-toggle="collapse" data-parent="#navigation">yii\mail <b class="caret"></b></a><div id="navigation-9373" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-mail-basemailer.html">BaseMailer</a>
<a class="list-group-item" href="./yii-mail-basemessage.html">BaseMessage</a>
<a class="list-group-item" href="./yii-mail-mailevent.html">MailEvent</a>
<a class="list-group-item" href="./yii-mail-mailerinterface.html">MailerInterface</a>
<a class="list-group-item" href="./yii-mail-messageinterface.html">MessageInterface</a></div>
<a class="list-group-item" href="#navigation-9374" data-toggle="collapse" data-parent="#navigation">yii\mutex <b class="caret"></b></a><div id="navigation-9374" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-mutex-dbmutex.html">DbMutex</a>
<a class="list-group-item" href="./yii-mutex-filemutex.html">FileMutex</a>
<a class="list-group-item" href="./yii-mutex-mutex.html">Mutex</a>
<a class="list-group-item" href="./yii-mutex-mysqlmutex.html">MysqlMutex</a>
<a class="list-group-item" href="./yii-mutex-pgsqlmutex.html">PgsqlMutex</a></div>
<a class="list-group-item" href="#navigation-9375" data-toggle="collapse" data-parent="#navigation">yii\rbac <b class="caret"></b></a><div id="navigation-9375" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-rbac-assignment.html">Assignment</a>
<a class="list-group-item" href="./yii-rbac-basemanager.html">BaseManager</a>
<a class="list-group-item" href="./yii-rbac-checkaccessinterface.html">CheckAccessInterface</a>
<a class="list-group-item" href="./yii-rbac-dbmanager.html">DbManager</a>
<a class="list-group-item" href="./yii-rbac-item.html">Item</a>
<a class="list-group-item" href="./yii-rbac-managerinterface.html">ManagerInterface</a>
<a class="list-group-item" href="./yii-rbac-permission.html">Permission</a>
<a class="list-group-item" href="./yii-rbac-phpmanager.html">PhpManager</a>
<a class="list-group-item" href="./yii-rbac-role.html">Role</a>
<a class="list-group-item" href="./yii-rbac-rule.html">Rule</a></div>
<a class="list-group-item" href="#navigation-9376" data-toggle="collapse" data-parent="#navigation">yii\rest <b class="caret"></b></a><div id="navigation-9376" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-rest-action.html">Action</a>
<a class="list-group-item" href="./yii-rest-activecontroller.html">ActiveController</a>
<a class="list-group-item" href="./yii-rest-controller.html">Controller</a>
<a class="list-group-item" href="./yii-rest-createaction.html">CreateAction</a>
<a class="list-group-item" href="./yii-rest-deleteaction.html">DeleteAction</a>
<a class="list-group-item" href="./yii-rest-indexaction.html">IndexAction</a>
<a class="list-group-item" href="./yii-rest-optionsaction.html">OptionsAction</a>
<a class="list-group-item" href="./yii-rest-serializer.html">Serializer</a>
<a class="list-group-item" href="./yii-rest-updateaction.html">UpdateAction</a>
<a class="list-group-item" href="./yii-rest-urlrule.html">UrlRule</a>
<a class="list-group-item" href="./yii-rest-viewaction.html">ViewAction</a></div>
<a class="list-group-item" href="#navigation-9377" data-toggle="collapse" data-parent="#navigation">yii\test <b class="caret"></b></a><div id="navigation-9377" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-test-activefixture.html">ActiveFixture</a>
<a class="list-group-item" href="./yii-test-arrayfixture.html">ArrayFixture</a>
<a class="list-group-item" href="./yii-test-baseactivefixture.html">BaseActiveFixture</a>
<a class="list-group-item" href="./yii-test-dbfixture.html">DbFixture</a>
<a class="list-group-item" href="./yii-test-fixture.html">Fixture</a>
<a class="list-group-item" href="./yii-test-fixturetrait.html">FixtureTrait</a>
<a class="list-group-item" href="./yii-test-initdbfixture.html">InitDbFixture</a></div>
<a class="list-group-item" href="#navigation-9378" data-toggle="collapse" data-parent="#navigation">yii\validators <b class="caret"></b></a><div id="navigation-9378" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-validators-booleanvalidator.html">BooleanValidator</a>
<a class="list-group-item" href="./yii-validators-comparevalidator.html">CompareValidator</a>
<a class="list-group-item" href="./yii-validators-datevalidator.html">DateValidator</a>
<a class="list-group-item" href="./yii-validators-defaultvaluevalidator.html">DefaultValueValidator</a>
<a class="list-group-item" href="./yii-validators-eachvalidator.html">EachValidator</a>
<a class="list-group-item" href="./yii-validators-emailvalidator.html">EmailValidator</a>
<a class="list-group-item" href="./yii-validators-existvalidator.html">ExistValidator</a>
<a class="list-group-item" href="./yii-validators-filevalidator.html">FileValidator</a>
<a class="list-group-item" href="./yii-validators-filtervalidator.html">FilterValidator</a>
<a class="list-group-item" href="./yii-validators-imagevalidator.html">ImageValidator</a>
<a class="list-group-item" href="./yii-validators-inlinevalidator.html">InlineValidator</a>
<a class="list-group-item" href="./yii-validators-ipvalidator.html">IpValidator</a>
<a class="list-group-item" href="./yii-validators-numbervalidator.html">NumberValidator</a>
<a class="list-group-item" href="./yii-validators-punycodeasset.html">PunycodeAsset</a>
<a class="list-group-item" href="./yii-validators-rangevalidator.html">RangeValidator</a>
<a class="list-group-item" href="./yii-validators-regularexpressionvalidator.html">RegularExpressionValidator</a>
<a class="list-group-item" href="./yii-validators-requiredvalidator.html">RequiredValidator</a>
<a class="list-group-item" href="./yii-validators-safevalidator.html">SafeValidator</a>
<a class="list-group-item" href="./yii-validators-stringvalidator.html">StringValidator</a>
<a class="list-group-item" href="./yii-validators-uniquevalidator.html">UniqueValidator</a>
<a class="list-group-item" href="./yii-validators-urlvalidator.html">UrlValidator</a>
<a class="list-group-item" href="./yii-validators-validationasset.html">ValidationAsset</a>
<a class="list-group-item" href="./yii-validators-validator.html">Validator</a></div>
<a class="list-group-item" href="#navigation-9379" data-toggle="collapse" data-parent="#navigation">yii\web <b class="caret"></b></a><div id="navigation-9379" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-web-application.html">Application</a>
<a class="list-group-item" href="./yii-web-assetbundle.html">AssetBundle</a>
<a class="list-group-item" href="./yii-web-assetconverter.html">AssetConverter</a>
<a class="list-group-item" href="./yii-web-assetconverterinterface.html">AssetConverterInterface</a>
<a class="list-group-item" href="./yii-web-assetmanager.html">AssetManager</a>
<a class="list-group-item" href="./yii-web-badrequesthttpexception.html">BadRequestHttpException</a>
<a class="list-group-item" href="./yii-web-cachesession.html">CacheSession</a>
<a class="list-group-item" href="./yii-web-compositeurlrule.html">CompositeUrlRule</a>
<a class="list-group-item" href="./yii-web-conflicthttpexception.html">ConflictHttpException</a>
<a class="list-group-item" href="./yii-web-controller.html">Controller</a>
<a class="list-group-item" href="./yii-web-cookie.html">Cookie</a>
<a class="list-group-item" href="./yii-web-cookiecollection.html">CookieCollection</a>
<a class="list-group-item" href="./yii-web-dbsession.html">DbSession</a>
<a class="list-group-item" href="./yii-web-erroraction.html">ErrorAction</a>
<a class="list-group-item" href="./yii-web-errorhandler.html">ErrorHandler</a>
<a class="list-group-item" href="./yii-web-forbiddenhttpexception.html">ForbiddenHttpException</a>
<a class="list-group-item" href="./yii-web-gonehttpexception.html">GoneHttpException</a>
<a class="list-group-item" href="./yii-web-groupurlrule.html">GroupUrlRule</a>
<a class="list-group-item" href="./yii-web-headercollection.html">HeaderCollection</a>
<a class="list-group-item" href="./yii-web-htmlresponseformatter.html">HtmlResponseFormatter</a>
<a class="list-group-item" href="./yii-web-httpexception.html">HttpException</a>
<a class="list-group-item" href="./yii-web-identityinterface.html">IdentityInterface</a>
<a class="list-group-item" href="./yii-web-jqueryasset.html">JqueryAsset</a>
<a class="list-group-item" href="./yii-web-jsexpression.html">JsExpression</a>
<a class="list-group-item" href="./yii-web-jsonparser.html">JsonParser</a>
<a class="list-group-item" href="./yii-web-jsonresponseformatter.html">JsonResponseFormatter</a>
<a class="list-group-item" href="./yii-web-link.html">Link</a>
<a class="list-group-item" href="./yii-web-linkable.html">Linkable</a>
<a class="list-group-item" href="./yii-web-methodnotallowedhttpexception.html">MethodNotAllowedHttpException</a>
<a class="list-group-item" href="./yii-web-multifieldsession.html">MultiFieldSession</a>
<a class="list-group-item" href="./yii-web-notacceptablehttpexception.html">NotAcceptableHttpException</a>
<a class="list-group-item" href="./yii-web-notfoundhttpexception.html">NotFoundHttpException</a>
<a class="list-group-item" href="./yii-web-request.html">Request</a>
<a class="list-group-item" href="./yii-web-requestparserinterface.html">RequestParserInterface</a>
<a class="list-group-item" href="./yii-web-response.html">Response</a>
<a class="list-group-item" href="./yii-web-responseformatterinterface.html">ResponseFormatterInterface</a>
<a class="list-group-item" href="./yii-web-servererrorhttpexception.html">ServerErrorHttpException</a>
<a class="list-group-item" href="./yii-web-session.html">Session</a>
<a class="list-group-item" href="./yii-web-sessioniterator.html">SessionIterator</a>
<a class="list-group-item" href="./yii-web-toomanyrequestshttpexception.html">TooManyRequestsHttpException</a>
<a class="list-group-item" href="./yii-web-unauthorizedhttpexception.html">UnauthorizedHttpException</a>
<a class="list-group-item" href="./yii-web-unprocessableentityhttpexception.html">UnprocessableEntityHttpException</a>
<a class="list-group-item" href="./yii-web-unsupportedmediatypehttpexception.html">UnsupportedMediaTypeHttpException</a>
<a class="list-group-item" href="./yii-web-uploadedfile.html">UploadedFile</a>
<a class="list-group-item" href="./yii-web-urlmanager.html">UrlManager</a>
<a class="list-group-item" href="./yii-web-urlrule.html">UrlRule</a>
<a class="list-group-item" href="./yii-web-urlruleinterface.html">UrlRuleInterface</a>
<a class="list-group-item" href="./yii-web-user.html">User</a>
<a class="list-group-item" href="./yii-web-userevent.html">UserEvent</a>
<a class="list-group-item" href="./yii-web-view.html">View</a>
<a class="list-group-item" href="./yii-web-viewaction.html">ViewAction</a>
<a class="list-group-item" href="./yii-web-xmlresponseformatter.html">XmlResponseFormatter</a>
<a class="list-group-item" href="./yii-web-yiiasset.html">YiiAsset</a></div>
<a class="list-group-item" href="#navigation-9380" data-toggle="collapse" data-parent="#navigation">yii\widgets <b class="caret"></b></a><div id="navigation-9380" class="submenu panel-collapse collapse"><a class="list-group-item" href="./yii-widgets-activefield.html">ActiveField</a>
<a class="list-group-item" href="./yii-widgets-activeform.html">ActiveForm</a>
<a class="list-group-item" href="./yii-widgets-activeformasset.html">ActiveFormAsset</a>
<a class="list-group-item" href="./yii-widgets-baselistview.html">BaseListView</a>
<a class="list-group-item" href="./yii-widgets-block.html">Block</a>
<a class="list-group-item" href="./yii-widgets-breadcrumbs.html">Breadcrumbs</a>
<a class="list-group-item" href="./yii-widgets-contentdecorator.html">ContentDecorator</a>
<a class="list-group-item" href="./yii-widgets-detailview.html">DetailView</a>
<a class="list-group-item" href="./yii-widgets-fragmentcache.html">FragmentCache</a>
<a class="list-group-item" href="./yii-widgets-inputwidget.html">InputWidget</a>
<a class="list-group-item" href="./yii-widgets-linkpager.html">LinkPager</a>
<a class="list-group-item" href="./yii-widgets-linksorter.html">LinkSorter</a>
<a class="list-group-item" href="./yii-widgets-listview.html">ListView</a>
<a class="list-group-item" href="./yii-widgets-maskedinput.html">MaskedInput</a>
<a class="list-group-item" href="./yii-widgets-maskedinputasset.html">MaskedInputAsset</a>
<a class="list-group-item" href="./yii-widgets-menu.html">Menu</a>
<a class="list-group-item" href="./yii-widgets-pjax.html">Pjax</a>
<a class="list-group-item" href="./yii-widgets-pjaxasset.html">PjaxAsset</a>
<a class="list-group-item" href="./yii-widgets-spaceless.html">Spaceless</a></div></div>    </div>
    <div class="col-md-9 api-content" role="main">
        <h1>Class yii\db\Connection</h1>
<div class="top-nav">
    <a href="index.html">All Classes</a>
            | <a href="#properties">Properties</a>
                | <a href="#methods">Methods</a>
                | <a href="#events">Events</a>
        </div>

<table class="summaryTable docClass table table-bordered">
    <colgroup>
        <col class="col-name" />
        <col class="col-value" />
    </colgroup>
            <tr><th>Inheritance</th><td><a href="yii-db-connection.html">yii\db\Connection</a> &raquo;
<a href="yii-base-component.html">yii\base\Component</a> &raquo;
<a href="yii-base-object.html">yii\base\Object</a></td></tr>
                <tr><th>Implements</th><td><a href="yii-base-configurable.html">yii\base\Configurable</a></td></tr>
                        <tr><th>Subclasses</th><td><a href="yii-sphinx-connection.html">yii\sphinx\Connection</a></td></tr>
                        <tr><th>Available since version</th><td>2.0</td></tr>
                    <tr>
          <th>Source Code</th>
          <td><a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php">https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php</a></td>
        </tr>
    </table>

<div class="class-description">
    <p><strong>Connection represents a connection to a database via <a href="php.net/manual/en/book.pdo.php">PDO</a>.</strong></p>
    <p>Connection works together with <a href="yii-db-command.html">yii\db\Command</a>, <a href="yii-db-datareader.html">yii\db\DataReader</a> and <a href="yii-db-transaction.html">yii\db\Transaction</a>
to provide data access to various DBMS in a common set of APIs. They are a thin wrapper
of the [[PDO PHP extension]](php.net/manual/en/book.pdo.php).</p>
<p>Connection supports database replication and read-write splitting. In particular, a Connection component
can be configured with multiple <a href="yii-db-connection.html#$masters-detail">$masters</a> and <a href="yii-db-connection.html#$slaves-detail">$slaves</a>. It will do load balancing and failover by choosing
appropriate servers. It will also automatically direct read operations to the slaves and write operations to
the masters.</p>
<p>To establish a DB connection, set <a href="yii-db-connection.html#$dsn-detail">$dsn</a>, <a href="yii-db-connection.html#$username-detail">$username</a> and <a href="yii-db-connection.html#$password-detail">$password</a>, and then
call <a href="yii-db-connection.html#open()-detail">open()</a> to be true.</p>
<p>The following example shows how to create a Connection instance and establish
the DB connection:</p>
<pre><code class="hljs php language-php"><span class="hljs-variable">$connection</span> = <span class="hljs-keyword">new</span> \yii\db\Connection([
    <span class="hljs-string">'dsn'</span> =&gt; <span class="hljs-variable">$dsn</span>,
    <span class="hljs-string">'username'</span> =&gt; <span class="hljs-variable">$username</span>,
    <span class="hljs-string">'password'</span> =&gt; <span class="hljs-variable">$password</span>,
]);
<span class="hljs-variable">$connection</span>-&gt;open();
</code></pre>
<p>After the DB connection is established, one can execute SQL statements like the following:</p>
<pre><code class="hljs php language-php"><span class="hljs-variable">$command</span> = <span class="hljs-variable">$connection</span>-&gt;createCommand(<span class="hljs-string">'SELECT * FROM post'</span>);
<span class="hljs-variable">$posts</span> = <span class="hljs-variable">$command</span>-&gt;queryAll();
<span class="hljs-variable">$command</span> = <span class="hljs-variable">$connection</span>-&gt;createCommand(<span class="hljs-string">'UPDATE post SET status=1'</span>);
<span class="hljs-variable">$command</span>-&gt;execute();
</code></pre>
<p>One can also do prepared SQL execution and bind parameters to the prepared SQL.
When the parameters are coming from user input, you should use this approach
to prevent SQL injection attacks. The following is an example:</p>
<pre><code class="hljs php language-php"><span class="hljs-variable">$command</span> = <span class="hljs-variable">$connection</span>-&gt;createCommand(<span class="hljs-string">'SELECT * FROM post WHERE id=:id'</span>);
<span class="hljs-variable">$command</span>-&gt;bindValue(<span class="hljs-string">':id'</span>, <span class="hljs-variable">$_GET</span>[<span class="hljs-string">'id'</span>]);
<span class="hljs-variable">$post</span> = <span class="hljs-variable">$command</span>-&gt;query();
</code></pre>
<p>For more information about how to perform various DB queries, please refer to <a href="yii-db-command.html">yii\db\Command</a>.</p>
<p>If the underlying DBMS supports transactions, you can perform transactional SQL queries
like the following:</p>
<pre><code class="hljs php language-php"><span class="hljs-variable">$transaction</span> = <span class="hljs-variable">$connection</span>-&gt;beginTransaction();
<span class="hljs-keyword">try</span> {
    <span class="hljs-variable">$connection</span>-&gt;createCommand(<span class="hljs-variable">$sql1</span>)-&gt;execute();
    <span class="hljs-variable">$connection</span>-&gt;createCommand(<span class="hljs-variable">$sql2</span>)-&gt;execute();
    <span class="hljs-comment">// ... executing other SQL statements ...</span>
    <span class="hljs-variable">$transaction</span>-&gt;commit();
} <span class="hljs-keyword">catch</span> (<span class="hljs-keyword">Exception</span> <span class="hljs-variable">$e</span>) {
    <span class="hljs-variable">$transaction</span>-&gt;rollBack();
}
</code></pre>
<p>You also can use shortcut for the above like the following:</p>
<pre><code class="hljs php language-php"><span class="hljs-variable">$connection</span>-&gt;transaction(<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-params">()</span> </span>{
    <span class="hljs-variable">$order</span> = <span class="hljs-keyword">new</span> Order(<span class="hljs-variable">$customer</span>);
    <span class="hljs-variable">$order</span>-&gt;save();
    <span class="hljs-variable">$order</span>-&gt;addItems(<span class="hljs-variable">$items</span>);
});
</code></pre>
<p>If needed you can pass transaction isolation level as a second parameter:</p>
<pre><code class="hljs php language-php"><span class="hljs-variable">$connection</span>-&gt;transaction(<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-params">(Connection <span class="hljs-variable">$db</span>)</span> </span>{
    <span class="hljs-comment">//return $db-&gt;...</span>
}, Transaction::READ_UNCOMMITTED);
</code></pre>
<p>Connection is often used as an application component and configured in the application
configuration like the following:</p>
<pre><code class="hljs php language-php"><span class="hljs-string">'components'</span> =&gt; [
    <span class="hljs-string">'db'</span> =&gt; [
        <span class="hljs-string">'class'</span> =&gt; <span class="hljs-string">'\yii\db\Connection'</span>,
        <span class="hljs-string">'dsn'</span> =&gt; <span class="hljs-string">'mysql:host=127.0.0.1;dbname=demo'</span>,
        <span class="hljs-string">'username'</span> =&gt; <span class="hljs-string">'root'</span>,
        <span class="hljs-string">'password'</span> =&gt; <span class="hljs-string">''</span>,
        <span class="hljs-string">'charset'</span> =&gt; <span class="hljs-string">'utf8'</span>,
    ],
],
</code></pre>

    </div>

<a id="properties"></a>

<div class="summary doc-property">
<h2>Public Properties</h2>

<p><a href="#" class="toggle">Hide inherited properties</a></p>

<table class="summary-table table table-striped table-bordered table-hover">
<colgroup>
    <col class="col-property" />
    <col class="col-type" />
    <col class="col-description" />
    <col class="col-defined" />
</colgroup>
<tr>
  <th>Property</th><th>Type</th><th>Description</th><th>Defined By</th>
</tr>
        <tr id="$attributes">
        <td><a href="yii-db-connection.html#$attributes-detail">$attributes</a></td>
        <td><a href="http://www.php.net/language.types.array">array</a></td>
        <td>PDO attributes (name =&gt; value) that should be set when calling <a href="yii-db-connection.html#open()-detail">open()</a>
to establish a DB connection.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr class="inherited" id="$behaviors">
        <td><a href="yii-base-component.html#$behaviors-detail">$behaviors</a></td>
        <td><a href="yii-base-behavior.html">yii\base\Behavior</a>[]</td>
        <td>List of behaviors attached to this component</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr id="$charset">
        <td><a href="yii-db-connection.html#$charset-detail">$charset</a></td>
        <td><a href="http://www.php.net/language.types.string">string</a></td>
        <td>The charset used for database connection.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$commandClass">
        <td><a href="yii-db-connection.html#$commandClass-detail">$commandClass</a></td>
        <td><a href="http://www.php.net/language.types.string">string</a></td>
        <td>The class used to create new database <a href="yii-db-command.html">yii\db\Command</a> objects.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$driverName">
        <td><a href="yii-db-connection.html#$driverName-detail">$driverName</a></td>
        <td><a href="http://www.php.net/language.types.string">string</a></td>
        <td>Name of the DB driver</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$dsn">
        <td><a href="yii-db-connection.html#$dsn-detail">$dsn</a></td>
        <td><a href="http://www.php.net/language.types.string">string</a></td>
        <td>The Data Source Name, or DSN, contains the information required to connect to the database.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$emulatePrepare">
        <td><a href="yii-db-connection.html#$emulatePrepare-detail">$emulatePrepare</a></td>
        <td><a href="http://www.php.net/language.types.boolean">boolean</a></td>
        <td>Whether to turn on prepare emulation.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$enableQueryCache">
        <td><a href="yii-db-connection.html#$enableQueryCache-detail">$enableQueryCache</a></td>
        <td><a href="http://www.php.net/language.types.boolean">boolean</a></td>
        <td>Whether to enable query caching.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$enableSavepoint">
        <td><a href="yii-db-connection.html#$enableSavepoint-detail">$enableSavepoint</a></td>
        <td><a href="http://www.php.net/language.types.boolean">boolean</a></td>
        <td>Whether to enable [savepoint](<a href="http://en">http://en</a>.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$enableSchemaCache">
        <td><a href="yii-db-connection.html#$enableSchemaCache-detail">$enableSchemaCache</a></td>
        <td><a href="http://www.php.net/language.types.boolean">boolean</a></td>
        <td>Whether to enable schema caching.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$enableSlaves">
        <td><a href="yii-db-connection.html#$enableSlaves-detail">$enableSlaves</a></td>
        <td><a href="http://www.php.net/language.types.boolean">boolean</a></td>
        <td>Whether to enable read/write splitting by using <a href="yii-db-connection.html#$slaves-detail">$slaves</a> to read data.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$isActive">
        <td><a href="yii-db-connection.html#$isActive-detail">$isActive</a></td>
        <td><a href="http://www.php.net/language.types.boolean">boolean</a></td>
        <td>Whether the DB connection is established</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$lastInsertID">
        <td><a href="yii-db-connection.html#$lastInsertID-detail">$lastInsertID</a></td>
        <td><a href="http://www.php.net/language.types.string">string</a></td>
        <td>The row ID of the last row inserted, or the last value retrieved from the sequence object</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$masterConfig">
        <td><a href="yii-db-connection.html#$masterConfig-detail">$masterConfig</a></td>
        <td><a href="http://www.php.net/language.types.array">array</a></td>
        <td>The configuration that should be merged with every master configuration listed in <a href="yii-db-connection.html#$masters-detail">$masters</a>.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$masterPdo">
        <td><a href="yii-db-connection.html#$masterPdo-detail">$masterPdo</a></td>
        <td><a href="http://www.php.net/class.pdo">PDO</a></td>
        <td>The PDO instance for the currently active master connection.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$masters">
        <td><a href="yii-db-connection.html#$masters-detail">$masters</a></td>
        <td><a href="http://www.php.net/language.types.array">array</a></td>
        <td>List of master connection configurations.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$password">
        <td><a href="yii-db-connection.html#$password-detail">$password</a></td>
        <td><a href="http://www.php.net/language.types.string">string</a></td>
        <td>The password for establishing DB connection.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$pdo">
        <td><a href="yii-db-connection.html#$pdo-detail">$pdo</a></td>
        <td><a href="http://www.php.net/class.pdo">PDO</a></td>
        <td>The PHP PDO instance associated with this DB connection.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$pdoClass">
        <td><a href="yii-db-connection.html#$pdoClass-detail">$pdoClass</a></td>
        <td><a href="http://www.php.net/language.types.string">string</a></td>
        <td>Custom PDO wrapper class.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$queryBuilder">
        <td><a href="yii-db-connection.html#$queryBuilder-detail">$queryBuilder</a></td>
        <td><a href="yii-db-querybuilder.html">yii\db\QueryBuilder</a></td>
        <td>The query builder for the current DB connection.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$queryCache">
        <td><a href="yii-db-connection.html#$queryCache-detail">$queryCache</a></td>
        <td><a href="yii-caching-cache.html">yii\caching\Cache</a>|<a href="http://www.php.net/language.types.string">string</a></td>
        <td>The cache object or the ID of the cache application component
that is used for query caching.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$queryCacheDuration">
        <td><a href="yii-db-connection.html#$queryCacheDuration-detail">$queryCacheDuration</a></td>
        <td><a href="http://www.php.net/language.types.integer">integer</a></td>
        <td>The default number of seconds that query results can remain valid in cache.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$schema">
        <td><a href="yii-db-connection.html#$schema-detail">$schema</a></td>
        <td><a href="yii-db-schema.html">yii\db\Schema</a></td>
        <td>The schema information for the database opened by this connection.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$schemaCache">
        <td><a href="yii-db-connection.html#$schemaCache-detail">$schemaCache</a></td>
        <td><a href="yii-caching-cache.html">yii\caching\Cache</a>|<a href="http://www.php.net/language.types.string">string</a></td>
        <td>The cache object or the ID of the cache application component that
is used to cache the table metadata.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$schemaCacheDuration">
        <td><a href="yii-db-connection.html#$schemaCacheDuration-detail">$schemaCacheDuration</a></td>
        <td><a href="http://www.php.net/language.types.integer">integer</a></td>
        <td>Number of seconds that table metadata can remain valid in cache.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$schemaCacheExclude">
        <td><a href="yii-db-connection.html#$schemaCacheExclude-detail">$schemaCacheExclude</a></td>
        <td><a href="http://www.php.net/language.types.array">array</a></td>
        <td>List of tables whose metadata should NOT be cached.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$schemaMap">
        <td><a href="yii-db-connection.html#$schemaMap-detail">$schemaMap</a></td>
        <td><a href="http://www.php.net/language.types.array">array</a></td>
        <td>Mapping between PDO driver names and <a href="yii-db-schema.html">yii\db\Schema</a> classes.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$serverRetryInterval">
        <td><a href="yii-db-connection.html#$serverRetryInterval-detail">$serverRetryInterval</a></td>
        <td><a href="http://www.php.net/language.types.integer">integer</a></td>
        <td>The retry interval in seconds for dead servers listed in <a href="yii-db-connection.html#$masters-detail">$masters</a> and <a href="yii-db-connection.html#$slaves-detail">$slaves</a>.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$serverStatusCache">
        <td><a href="yii-db-connection.html#$serverStatusCache-detail">$serverStatusCache</a></td>
        <td><a href="yii-caching-cache.html">yii\caching\Cache</a>|<a href="http://www.php.net/language.types.string">string</a></td>
        <td>The cache object or the ID of the cache application component that is used to store
the health status of the DB servers specified in <a href="yii-db-connection.html#$masters-detail">$masters</a> and <a href="yii-db-connection.html#$slaves-detail">$slaves</a>.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$slave">
        <td><a href="yii-db-connection.html#$slave-detail">$slave</a></td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
        <td>The currently active slave connection.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$slaveConfig">
        <td><a href="yii-db-connection.html#$slaveConfig-detail">$slaveConfig</a></td>
        <td><a href="http://www.php.net/language.types.array">array</a></td>
        <td>The configuration that should be merged with every slave configuration listed in <a href="yii-db-connection.html#$slaves-detail">$slaves</a>.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$slavePdo">
        <td><a href="yii-db-connection.html#$slavePdo-detail">$slavePdo</a></td>
        <td><a href="http://www.php.net/class.pdo">PDO</a></td>
        <td>The PDO instance for the currently active slave connection.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$slaves">
        <td><a href="yii-db-connection.html#$slaves-detail">$slaves</a></td>
        <td><a href="http://www.php.net/language.types.array">array</a></td>
        <td>List of slave connection configurations.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$tablePrefix">
        <td><a href="yii-db-connection.html#$tablePrefix-detail">$tablePrefix</a></td>
        <td><a href="http://www.php.net/language.types.string">string</a></td>
        <td>The common prefix or suffix for table names.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$transaction">
        <td><a href="yii-db-connection.html#$transaction-detail">$transaction</a></td>
        <td><a href="yii-db-transaction.html">yii\db\Transaction</a></td>
        <td>The currently active transaction.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="$username">
        <td><a href="yii-db-connection.html#$username-detail">$username</a></td>
        <td><a href="http://www.php.net/language.types.string">string</a></td>
        <td>The username for establishing DB connection.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
    </table>
</div>

<a id="methods"></a>

<div class="summary doc-method">
<h2>Public Methods</h2>

<p><a href="#" class="toggle">Hide inherited methods</a></p>

<table class="summary-table table table-striped table-bordered table-hover">
<colgroup>
    <col class="col-method" />
    <col class="col-description" />
    <col class="col-defined" />
</colgroup>
<tr>
  <th>Method</th><th>Description</th><th>Defined By</th>
</tr>
        <tr class="inherited" id="__call()">
        <td><a href="yii-base-component.html#__call()-detail">__call()</a></td>
        <td>Calls the named method which is not a class method.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="__clone()">
        <td><a href="yii-base-component.html#__clone()-detail">__clone()</a></td>
        <td>This method is called after the object is created by cloning an existing one.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="__construct()">
        <td><a href="yii-base-object.html#__construct()-detail">__construct()</a></td>
        <td>Constructor.</td>
        <td><a href="yii-base-object.html">yii\base\Object</a></td>
    </tr>
            <tr class="inherited" id="__get()">
        <td><a href="yii-base-component.html#__get()-detail">__get()</a></td>
        <td>Returns the value of a component property.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="__isset()">
        <td><a href="yii-base-component.html#__isset()-detail">__isset()</a></td>
        <td>Checks if a property is set, i.e. defined and not null.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="__set()">
        <td><a href="yii-base-component.html#__set()-detail">__set()</a></td>
        <td>Sets the value of a component property.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr id="__sleep()">
        <td><a href="yii-db-connection.html#__sleep()-detail">__sleep()</a></td>
        <td>Close the connection before serializing.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr class="inherited" id="__unset()">
        <td><a href="yii-base-component.html#__unset()-detail">__unset()</a></td>
        <td>Sets a component property to be null.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="attachBehavior()">
        <td><a href="yii-base-component.html#attachBehavior()-detail">attachBehavior()</a></td>
        <td>Attaches a behavior to this component.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="attachBehaviors()">
        <td><a href="yii-base-component.html#attachBehaviors()-detail">attachBehaviors()</a></td>
        <td>Attaches a list of behaviors to the component.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr id="beginTransaction()">
        <td><a href="yii-db-connection.html#beginTransaction()-detail">beginTransaction()</a></td>
        <td>Starts a transaction.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr class="inherited" id="behaviors()">
        <td><a href="yii-base-component.html#behaviors()-detail">behaviors()</a></td>
        <td>Returns a list of behaviors that this component should behave as.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr id="cache()">
        <td><a href="yii-db-connection.html#cache()-detail">cache()</a></td>
        <td>Uses query cache for the queries performed with the callable.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr class="inherited" id="canGetProperty()">
        <td><a href="yii-base-component.html#canGetProperty()-detail">canGetProperty()</a></td>
        <td>Returns a value indicating whether a property can be read.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="canSetProperty()">
        <td><a href="yii-base-component.html#canSetProperty()-detail">canSetProperty()</a></td>
        <td>Returns a value indicating whether a property can be set.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="className()">
        <td><a href="yii-base-object.html#className()-detail">className()</a></td>
        <td>Returns the fully qualified name of this class.</td>
        <td><a href="yii-base-object.html">yii\base\Object</a></td>
    </tr>
            <tr id="close()">
        <td><a href="yii-db-connection.html#close()-detail">close()</a></td>
        <td>Closes the currently active DB connection.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="createCommand()">
        <td><a href="yii-db-connection.html#createCommand()-detail">createCommand()</a></td>
        <td>Creates a command for execution.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
                <tr class="inherited" id="detachBehavior()">
        <td><a href="yii-base-component.html#detachBehavior()-detail">detachBehavior()</a></td>
        <td>Detaches a behavior from the component.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="detachBehaviors()">
        <td><a href="yii-base-component.html#detachBehaviors()-detail">detachBehaviors()</a></td>
        <td>Detaches all behaviors from the component.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="ensureBehaviors()">
        <td><a href="yii-base-component.html#ensureBehaviors()-detail">ensureBehaviors()</a></td>
        <td>Makes sure that the behaviors declared in <a href="yii-base-component.html#behaviors()-detail">behaviors()</a> are attached to this component.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="getBehavior()">
        <td><a href="yii-base-component.html#getBehavior()-detail">getBehavior()</a></td>
        <td>Returns the named behavior object.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="getBehaviors()">
        <td><a href="yii-base-component.html#getBehaviors()-detail">getBehaviors()</a></td>
        <td>Returns all behaviors attached to this component.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr id="getDriverName()">
        <td><a href="yii-db-connection.html#getDriverName()-detail">getDriverName()</a></td>
        <td>Returns the name of the DB driver. Based on the the current <a href="yii-db-connection.html#$dsn-detail">$dsn</a>, in case it was not set explicitly
by an end user.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="getIsActive()">
        <td><a href="yii-db-connection.html#getIsActive()-detail">getIsActive()</a></td>
        <td>Returns a value indicating whether the DB connection is established.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="getLastInsertID()">
        <td><a href="yii-db-connection.html#getLastInsertID()-detail">getLastInsertID()</a></td>
        <td>Returns the ID of the last inserted row or sequence value.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="getMasterPdo()">
        <td><a href="yii-db-connection.html#getMasterPdo()-detail">getMasterPdo()</a></td>
        <td>Returns the PDO instance for the currently active master connection.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="getQueryBuilder()">
        <td><a href="yii-db-connection.html#getQueryBuilder()-detail">getQueryBuilder()</a></td>
        <td>Returns the query builder for the current DB connection.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="getQueryCacheInfo()">
        <td><a href="yii-db-connection.html#getQueryCacheInfo()-detail">getQueryCacheInfo()</a></td>
        <td>Returns the current query cache information.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="getSchema()">
        <td><a href="yii-db-connection.html#getSchema()-detail">getSchema()</a></td>
        <td>Returns the schema information for the database opened by this connection.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="getSlave()">
        <td><a href="yii-db-connection.html#getSlave()-detail">getSlave()</a></td>
        <td>Returns the currently active slave connection.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="getSlavePdo()">
        <td><a href="yii-db-connection.html#getSlavePdo()-detail">getSlavePdo()</a></td>
        <td>Returns the PDO instance for the currently active slave connection.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="getTableSchema()">
        <td><a href="yii-db-connection.html#getTableSchema()-detail">getTableSchema()</a></td>
        <td>Obtains the schema information for the named table.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="getTransaction()">
        <td><a href="yii-db-connection.html#getTransaction()-detail">getTransaction()</a></td>
        <td>Returns the currently active transaction.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr class="inherited" id="hasEventHandlers()">
        <td><a href="yii-base-component.html#hasEventHandlers()-detail">hasEventHandlers()</a></td>
        <td>Returns a value indicating whether there is any handler attached to the named event.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="hasMethod()">
        <td><a href="yii-base-component.html#hasMethod()-detail">hasMethod()</a></td>
        <td>Returns a value indicating whether a method is defined.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="hasProperty()">
        <td><a href="yii-base-component.html#hasProperty()-detail">hasProperty()</a></td>
        <td>Returns a value indicating whether a property is defined for this component.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="init()">
        <td><a href="yii-base-object.html#init()-detail">init()</a></td>
        <td>Initializes the object.</td>
        <td><a href="yii-base-object.html">yii\base\Object</a></td>
    </tr>
                <tr id="noCache()">
        <td><a href="yii-db-connection.html#noCache()-detail">noCache()</a></td>
        <td>Disables query cache temporarily.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr class="inherited" id="off()">
        <td><a href="yii-base-component.html#off()-detail">off()</a></td>
        <td>Detaches an existing event handler from this component.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr class="inherited" id="on()">
        <td><a href="yii-base-component.html#on()-detail">on()</a></td>
        <td>Attaches an event handler to an event.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr id="open()">
        <td><a href="yii-db-connection.html#open()-detail">open()</a></td>
        <td>Establishes a DB connection.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
                <tr id="quoteColumnName()">
        <td><a href="yii-db-connection.html#quoteColumnName()-detail">quoteColumnName()</a></td>
        <td>Quotes a column name for use in a query.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="quoteSql()">
        <td><a href="yii-db-connection.html#quoteSql()-detail">quoteSql()</a></td>
        <td>Processes a SQL statement by quoting table and column names that are enclosed within double brackets.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="quoteTableName()">
        <td><a href="yii-db-connection.html#quoteTableName()-detail">quoteTableName()</a></td>
        <td>Quotes a table name for use in a query.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="quoteValue()">
        <td><a href="yii-db-connection.html#quoteValue()-detail">quoteValue()</a></td>
        <td>Quotes a string value for use in a query.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="setDriverName()">
        <td><a href="yii-db-connection.html#setDriverName()-detail">setDriverName()</a></td>
        <td>Changes the current driver name.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr id="transaction()">
        <td><a href="yii-db-connection.html#transaction()-detail">transaction()</a></td>
        <td>Executes callback provided in a transaction.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
            <tr class="inherited" id="trigger()">
        <td><a href="yii-base-component.html#trigger()-detail">trigger()</a></td>
        <td>Triggers an event.</td>
        <td><a href="yii-base-component.html">yii\base\Component</a></td>
    </tr>
            <tr id="useMaster()">
        <td><a href="yii-db-connection.html#useMaster()-detail">useMaster()</a></td>
        <td>Executes the provided callback by using the master connection.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
    </table>
</div>

<div class="summary doc-method">
<h2>Protected Methods</h2>

<p><a href="#" class="toggle">Hide inherited methods</a></p>

<table class="summary-table table table-striped table-bordered table-hover">
<colgroup>
    <col class="col-method" />
    <col class="col-description" />
    <col class="col-defined" />
</colgroup>
<tr>
  <th>Method</th><th>Description</th><th>Defined By</th>
</tr>
                                                                                <tr id="createPdoInstance()">
        <td><a href="yii-db-connection.html#createPdoInstance()-detail">createPdoInstance()</a></td>
        <td>Creates the PDO instance.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
                                                                                            <tr id="initConnection()">
        <td><a href="yii-db-connection.html#initConnection()-detail">initConnection()</a></td>
        <td>Initializes the DB connection.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
                            <tr id="openFromPool()">
        <td><a href="yii-db-connection.html#openFromPool()-detail">openFromPool()</a></td>
        <td>Opens the connection to a server in the pool.</td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
                                    </table>
</div>

<a id="events"></a>
<div class="summary doc-event">
    <h2>Events</h2>

    <p><a href="#" class="toggle">Hide inherited events</a></p>

    <table class="summary-table table table-striped table-bordered table-hover">
    <colgroup>
        <col class="col-event" />
        <col class="col-type" />
        <col class="col-description" />
        <col class="col-defined" />
    </colgroup>
    <tr>
        <th>Event</th><th>Type</th><th>Description</th><th>Defined By</th>
    </tr>
        <tr id="EVENT_AFTER_OPEN">
        <td><a href="yii-db-connection.html#EVENT_AFTER_OPEN-detail">EVENT_AFTER_OPEN</a></td>
        <td>\yii\db\Event</td>
        <td>
            An event that is triggered after a DB connection is established                    </td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
        <tr id="EVENT_BEGIN_TRANSACTION">
        <td><a href="yii-db-connection.html#EVENT_BEGIN_TRANSACTION-detail">EVENT_BEGIN_TRANSACTION</a></td>
        <td>\yii\db\Event</td>
        <td>
            An event that is triggered right before a top-level transaction is started                    </td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
        <tr id="EVENT_COMMIT_TRANSACTION">
        <td><a href="yii-db-connection.html#EVENT_COMMIT_TRANSACTION-detail">EVENT_COMMIT_TRANSACTION</a></td>
        <td>\yii\db\Event</td>
        <td>
            An event that is triggered right after a top-level transaction is committed                    </td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
        <tr id="EVENT_ROLLBACK_TRANSACTION">
        <td><a href="yii-db-connection.html#EVENT_ROLLBACK_TRANSACTION-detail">EVENT_ROLLBACK_TRANSACTION</a></td>
        <td>\yii\db\Event</td>
        <td>
            An event that is triggered right after a top-level transaction is rolled back                    </td>
        <td><a href="yii-db-connection.html">yii\db\Connection</a></td>
    </tr>
        </table>
</div>

<a id="constants"></a>

<h2>Property Details</h2>

<div class="property-doc">

    <div class="detail-header h3" id="$attributes-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$attributes-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L177" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L177" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $attributes        <span class="detail-header-tag small">
            public                                                property
                    </span>
    </div>

    <div class="doc-description">
        <p>PDO attributes (name =&gt; value) that should be set when calling <a href="yii-db-connection.html#open()-detail">open()</a>
to establish a DB connection. Please refer to the
<a href="http://www.php.net/manual/en/function.PDO-setAttribute.php">PHP manual</a> for
details about available attributes.</p>

            </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.array">array</a></span> <a href="yii-db-connection.html#$attributes-detail">$attributes</a> <span style="color: #0000BB"></span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">null</span></div>


    <div class="detail-header h3" id="$charset-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$charset-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L249" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L249" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $charset        <span class="detail-header-tag small">
            public                                                property
                    </span>
    </div>

    <div class="doc-description">
        <p>The charset used for database connection. The property is only used
for MySQL, PostgreSQL and CUBRID databases. Defaults to null, meaning using default charset
as configured by the database.</p>
<p>For Oracle Database, the charset must be specified in the <a href="yii-db-connection.html#$dsn-detail">$dsn</a>, for example for UTF-8 by appending <code>;charset=UTF-8</code>
to the DSN string.</p>
<p>The same applies for if you're using GBK or BIG5 charset with MySQL, then it's highly recommended to
specify charset via <a href="yii-db-connection.html#$dsn-detail">$dsn</a> like <code>'mysql:dbname=mydatabase;host=127.0.0.1;charset=GBK;'</code>.</p>

            </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.string">string</a></span> <a href="yii-db-connection.html#$charset-detail">$charset</a> <span style="color: #0000BB"></span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">null</span></div>


    <div class="detail-header h3" id="$commandClass-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$commandClass-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L297" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L297" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $commandClass        <span class="detail-header-tag small">
            public                                                property
                            (available since version 2.0.7)
                    </span>
    </div>

    <div class="doc-description">
        <p>The class used to create new database <a href="yii-db-command.html">yii\db\Command</a> objects. If you want to extend the <a href="yii-db-command.html">yii\db\Command</a> class,
you may configure this property to use your extended version of the class.</p>

        <p>See also <a href="yii-db-connection.html#createCommand()-detail">createCommand()</a>.</p>    </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.string">string</a></span> <a href="yii-db-connection.html#$commandClass-detail">$commandClass</a> <span style="color: #0000BB"></span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'yii\db\Command'</span></div>


    <div class="detail-header h3" id="$driverName-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$driverName-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $driverName        <span class="detail-header-tag small">
            public                                                property
                    </span>
    </div>

    <div class="doc-description">
        <p>Name of the DB driver</p>

            </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.string">string</a></span> <strong><a href="yii-db-connection.html#getDriverName()-detail">getDriverName</a></strong> ( )<br /><span class="signature-defs">public</span> <span class="signature-type">void</span> <strong><a href="yii-db-connection.html#setDriverName()-detail">setDriverName</a></strong> ( <span style="color: #0000BB">$driverName</span> )</div>


    <div class="detail-header h3" id="$dsn-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$dsn-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L162" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L162" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $dsn        <span class="detail-header-tag small">
            public                                                property
                    </span>
    </div>

    <div class="doc-description">
        <p>The Data Source Name, or DSN, contains the information required to connect to the database.
Please refer to the <a href="http://www.php.net/manual/en/function.PDO-construct.php">PHP manual</a> on
the format of the DSN string.</p>
<p>For <a href="http://php.net/manual/en/ref.pdo-sqlite.connection.php">SQLite</a> you may use a path alias
for specifying the database path, e.g. <code>sqlite:@app/data/db.sql</code>.</p>

        <p>See also <a href="yii-db-connection.html#$charset-detail">$charset</a>.</p>    </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.string">string</a></span> <a href="yii-db-connection.html#$dsn-detail">$dsn</a> <span style="color: #0000BB"></span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">null</span></div>


    <div class="detail-header h3" id="$emulatePrepare-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$emulatePrepare-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L257" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L257" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $emulatePrepare        <span class="detail-header-tag small">
            public                                                property
                    </span>
    </div>

    <div class="doc-description">
        <p>Whether to turn on prepare emulation. Defaults to false, meaning PDO
will use the native prepare support if available. For some databases (such as MySQL),
this may need to be set true so that PDO can emulate the prepare support to bypass
the buggy native prepare support.
The default value is null, which means the PDO ATTR_EMULATE_PREPARES value will not be changed.</p>

            </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.boolean">boolean</a></span> <a href="yii-db-connection.html#$emulatePrepare-detail">$emulatePrepare</a> <span style="color: #0000BB"></span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">null</span></div>


    <div class="detail-header h3" id="$enableQueryCache-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$enableQueryCache-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L222" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L222" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $enableQueryCache        <span class="detail-header-tag small">
            public                                                property
                    </span>
    </div>

    <div class="doc-description">
        <p>Whether to enable query caching.
Note that in order to enable query caching, a valid cache component as specified
by <a href="yii-db-connection.html#$queryCache-detail">$queryCache</a> must be enabled and <a href="yii-db-connection.html#$enableQueryCache-detail">$enableQueryCache</a> must be set true.
Also, only the results of the queries enclosed within <a href="yii-db-connection.html#cache()-detail">cache()</a> will be cached.</p>

        <p>See also:</p><ul><li><a href="yii-db-connection.html#$queryCache-detail">$queryCache</a></li><li><a href="yii-db-connection.html#cache()-detail">cache()</a></li><li><a href="yii-db-connection.html#noCache()-detail">noCache()</a></li></ul>    </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.boolean">boolean</a></span> <a href="yii-db-connection.html#$enableQueryCache-detail">$enableQueryCache</a> <span style="color: #0000BB"></span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">true</span></div>


    <div class="detail-header h3" id="$enableSavepoint-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$enableSavepoint-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L302" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L302" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $enableSavepoint        <span class="detail-header-tag small">
            public                                                property
                    </span>
    </div>

    <div class="doc-description">
        <p>Whether to enable <a href="http://en.wikipedia.org/wiki/Savepoint">savepoint</a>.
Note that if the underlying DBMS does not support savepoint, setting this property to be true will have no effect.</p>

            </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.boolean">boolean</a></span> <a href="yii-db-connection.html#$enableSavepoint-detail">$enableSavepoint</a> <span style="color: #0000BB"></span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">true</span></div>


    <div class="detail-header h3" id="$enableSchemaCache-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$enableSchemaCache-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L194" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L194" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $enableSchemaCache        <span class="detail-header-tag small">
            public                                                property
                    </span>
    </div>

    <div class="doc-description">
        <p>Whether to enable schema caching.
Note that in order to enable truly schema caching, a valid cache component as specified
by <a href="yii-db-connection.html#$schemaCache-detail">$schemaCache</a> must be enabled and <a href="yii-db-connection.html#$enableSchemaCache-detail">$enableSchemaCache</a> must be set true.</p>

        <p>See also:</p><ul><li><a href="yii-db-connection.html#$schemaCacheDuration-detail">$schemaCacheDuration</a></li><li><a href="yii-db-connection.html#$schemaCacheExclude-detail">$schemaCacheExclude</a></li><li><a href="yii-db-connection.html#$schemaCache-detail">$schemaCache</a></li></ul>    </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.boolean">boolean</a></span> <a href="yii-db-connection.html#$enableSchemaCache-detail">$enableSchemaCache</a> <span style="color: #0000BB"></span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">false</span></div>


    <div class="detail-header h3" id="$enableSlaves-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$enableSlaves-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L318" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L318" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $enableSlaves        <span class="detail-header-tag small">
            public                                                property
                    </span>
    </div>

    <div class="doc-description">
        <p>Whether to enable read/write splitting by using <a href="yii-db-connection.html#$slaves-detail">$slaves</a> to read data.
Note that if <a href="yii-db-connection.html#$slaves-detail">$slaves</a> is empty, read/write splitting will NOT be enabled no matter what value this property takes.</p>

            </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.boolean">boolean</a></span> <a href="yii-db-connection.html#$enableSlaves-detail">$enableSlaves</a> <span style="color: #0000BB"></span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">true</span></div>


    <div class="detail-header h3" id="$isActive-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$isActive-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $isActive        <span class="detail-header-tag small">
            public                         <em>read-only</em>                         property
                    </span>
    </div>

    <div class="doc-description">
        <p>Whether the DB connection is established</p>

            </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.boolean">boolean</a></span> <strong><a href="yii-db-connection.html#getIsActive()-detail">getIsActive</a></strong> ( )</div>


    <div class="detail-header h3" id="$lastInsertID-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$lastInsertID-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $lastInsertID        <span class="detail-header-tag small">
            public                         <em>read-only</em>                         property
                    </span>
    </div>

    <div class="doc-description">
        <p>The row ID of the last row inserted, or the last value retrieved from the sequence object</p>

            </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.string">string</a></span> <strong><a href="yii-db-connection.html#getLastInsertID()-detail">getLastInsertID</a></strong> ( <span style="color: #0000BB">$sequenceName&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">''</span> )</div>


    <div class="detail-header h3" id="$masterConfig-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$masterConfig-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L367" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L367" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $masterConfig        <span class="detail-header-tag small">
            public                                                property
                    </span>
    </div>

    <div class="doc-description">
        <p>The configuration that should be merged with every master configuration listed in <a href="yii-db-connection.html#$masters-detail">$masters</a>.
For example,</p>
<pre><code class="hljs php language-php">[
    <span class="hljs-string">'username'</span> =&gt; <span class="hljs-string">'master'</span>,
    <span class="hljs-string">'password'</span> =&gt; <span class="hljs-string">'master'</span>,
    <span class="hljs-string">'attributes'</span> =&gt; [
        <span class="hljs-comment">// use a smaller connection timeout</span>
        PDO::ATTR_TIMEOUT =&gt; <span class="hljs-number">10</span>,
    ],
]
</code></pre>

            </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.array">array</a></span> <a href="yii-db-connection.html#$masterConfig-detail">$masterConfig</a> <span style="color: #0000BB"></span><span style="color: #007700">=&nbsp;[]</span></div>


    <div class="detail-header h3" id="$masterPdo-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$masterPdo-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $masterPdo        <span class="detail-header-tag small">
            public                         <em>read-only</em>                         property
                    </span>
    </div>

    <div class="doc-description">
        <p>The PDO instance for the currently active master connection.</p>

            </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/class.pdo">PDO</a></span> <strong><a href="yii-db-connection.html#getMasterPdo()-detail">getMasterPdo</a></strong> ( )</div>


    <div class="detail-header h3" id="$masters-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$masters-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L351" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L351" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $masters        <span class="detail-header-tag small">
            public                                                property
                    </span>
    </div>

    <div class="doc-description">
        <p>List of master connection configurations. Each configuration is used to create a master DB connection.
When <a href="yii-db-connection.html#open()-detail">open()</a> is called, one of these configurations will be chosen and used to create a DB connection
which will be used by this object.
Note that when this property is not empty, the connection setting (e.g. "dsn", "username") of this object will
be ignored.</p>

        <p>See also <a href="yii-db-connection.html#$masterConfig-detail">$masterConfig</a>.</p>    </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.array">array</a></span> <a href="yii-db-connection.html#$masters-detail">$masters</a> <span style="color: #0000BB"></span><span style="color: #007700">=&nbsp;[]</span></div>


    <div class="detail-header h3" id="$password-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$password-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L170" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L170" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $password        <span class="detail-header-tag small">
            public                                                property
                    </span>
    </div>

    <div class="doc-description">
        <p>The password for establishing DB connection. Defaults to <code>null</code> meaning no password to use.</p>

            </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.string">string</a></span> <a href="yii-db-connection.html#$password-detail">$password</a> <span style="color: #0000BB"></span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">null</span></div>


    <div class="detail-header h3" id="$pdo-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$pdo-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L185" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L185" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $pdo        <span class="detail-header-tag small">
            public                                                property
                    </span>
    </div>

    <div class="doc-description">
        <p>The PHP PDO instance associated with this DB connection.
This property is mainly managed by <a href="yii-db-connection.html#open()-detail">open()</a> and <a href="yii-db-connection.html#close()-detail">close()</a> methods.
When a DB connection is active, this property will represent a PDO instance;
otherwise, it will be null.</p>

        <p>See also <a href="yii-db-connection.html#$pdoClass-detail">$pdoClass</a>.</p>    </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/class.pdo">PDO</a></span> <a href="yii-db-connection.html#$pdo-detail">$pdo</a> <span style="color: #0000BB"></span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">null</span></div>


    <div class="detail-header h3" id="$pdoClass-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$pdoClass-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L290" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L290" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $pdoClass        <span class="detail-header-tag small">
            public                                                property
                    </span>
    </div>

    <div class="doc-description">
        <p>Custom PDO wrapper class. If not set, it will use <a href="http://www.php.net/class.pdo">PDO</a> or <span class="broken-link">\yii\db\yii\db\mssql\PDO</span> when MSSQL is used.</p>

        <p>See also <a href="yii-db-connection.html#$pdo-detail">$pdo</a>.</p>    </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.string">string</a></span> <a href="yii-db-connection.html#$pdoClass-detail">$pdoClass</a> <span style="color: #0000BB"></span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">null</span></div>


    <div class="detail-header h3" id="$queryBuilder-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$queryBuilder-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $queryBuilder        <span class="detail-header-tag small">
            public                         <em>read-only</em>                         property
                    </span>
    </div>

    <div class="doc-description">
        <p>The query builder for the current DB connection.</p>

            </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="yii-db-querybuilder.html">yii\db\QueryBuilder</a></span> <strong><a href="yii-db-connection.html#getQueryBuilder()-detail">getQueryBuilder</a></strong> ( )</div>


    <div class="detail-header h3" id="$queryCache-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$queryCache-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L237" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L237" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $queryCache        <span class="detail-header-tag small">
            public                                                property
                    </span>
    </div>

    <div class="doc-description">
        <p>The cache object or the ID of the cache application component
that is used for query caching.</p>

        <p>See also <a href="yii-db-connection.html#$enableQueryCache-detail">$enableQueryCache</a>.</p>    </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="yii-caching-cache.html">yii\caching\Cache</a>|<a href="http://www.php.net/language.types.string">string</a></span> <a href="yii-db-connection.html#$queryCache-detail">$queryCache</a> <span style="color: #0000BB"></span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'cache'</span></div>


    <div class="detail-header h3" id="$queryCacheDuration-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$queryCacheDuration-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L231" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L231" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $queryCacheDuration        <span class="detail-header-tag small">
            public                                                property
                    </span>
    </div>

    <div class="doc-description">
        <p>The default number of seconds that query results can remain valid in cache.
Use 0 to indicate that the cached data will never expire.
Defaults to 3600, meaning 3600 seconds, or one hour. Use 0 to indicate that the cached data will never expire.
The value of this property will be used when <a href="yii-db-connection.html#cache()-detail">cache()</a> is called without a cache duration.</p>

        <p>See also:</p><ul><li><a href="yii-db-connection.html#$enableQueryCache-detail">$enableQueryCache</a></li><li><a href="yii-db-connection.html#cache()-detail">cache()</a></li></ul>    </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.integer">integer</a></span> <a href="yii-db-connection.html#$queryCacheDuration-detail">$queryCacheDuration</a> <span style="color: #0000BB"></span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">3600</span></div>


    <div class="detail-header h3" id="$schema-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$schema-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $schema        <span class="detail-header-tag small">
            public                         <em>read-only</em>                         property
                    </span>
    </div>

    <div class="doc-description">
        <p>The schema information for the database opened by this connection.</p>

            </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="yii-db-schema.html">yii\db\Schema</a></span> <strong><a href="yii-db-connection.html#getSchema()-detail">getSchema</a></strong> ( )</div>


    <div class="detail-header h3" id="$schemaCache-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$schemaCache-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L212" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L212" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $schemaCache        <span class="detail-header-tag small">
            public                                                property
                    </span>
    </div>

    <div class="doc-description">
        <p>The cache object or the ID of the cache application component that
is used to cache the table metadata.</p>

        <p>See also <a href="yii-db-connection.html#$enableSchemaCache-detail">$enableSchemaCache</a>.</p>    </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="yii-caching-cache.html">yii\caching\Cache</a>|<a href="http://www.php.net/language.types.string">string</a></span> <a href="yii-db-connection.html#$schemaCache-detail">$schemaCache</a> <span style="color: #0000BB"></span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'cache'</span></div>


    <div class="detail-header h3" id="$schemaCacheDuration-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$schemaCacheDuration-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L200" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L200" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $schemaCacheDuration        <span class="detail-header-tag small">
            public                                                property
                    </span>
    </div>

    <div class="doc-description">
        <p>Number of seconds that table metadata can remain valid in cache.
Use 0 to indicate that the cached data will never expire.</p>

        <p>See also <a href="yii-db-connection.html#$enableSchemaCache-detail">$enableSchemaCache</a>.</p>    </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.integer">integer</a></span> <a href="yii-db-connection.html#$schemaCacheDuration-detail">$schemaCacheDuration</a> <span style="color: #0000BB"></span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">3600</span></div>


    <div class="detail-header h3" id="$schemaCacheExclude-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$schemaCacheExclude-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L206" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L206" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $schemaCacheExclude        <span class="detail-header-tag small">
            public                                                property
                    </span>
    </div>

    <div class="doc-description">
        <p>List of tables whose metadata should NOT be cached. Defaults to empty array.
The table names may contain schema prefix, if any. Do not quote the table names.</p>

        <p>See also <a href="yii-db-connection.html#$enableSchemaCache-detail">$enableSchemaCache</a>.</p>    </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.array">array</a></span> <a href="yii-db-connection.html#$schemaCacheExclude-detail">$schemaCacheExclude</a> <span style="color: #0000BB"></span><span style="color: #007700">=&nbsp;[]</span></div>


    <div class="detail-header h3" id="$schemaMap-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$schemaMap-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L274" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L274" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $schemaMap        <span class="detail-header-tag small">
            public                                                property
                    </span>
    </div>

    <div class="doc-description">
        <p>Mapping between PDO driver names and <a href="yii-db-schema.html">yii\db\Schema</a> classes.
The keys of the array are PDO driver names while the values the corresponding
schema class name or configuration. Please refer to <a href="yii-baseyii.html#createObject()-detail">Yii::createObject()</a> for
details on how to specify a configuration.</p>
<p>This property is mainly used by <a href="yii-db-connection.html#getSchema()-detail">getSchema()</a> when fetching the database schema information.
You normally do not need to set this property unless you want to use your own
<a href="yii-db-schema.html">yii\db\Schema</a> class to support DBMS that is not supported by Yii.</p>

            </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.array">array</a></span> <a href="yii-db-connection.html#$schemaMap-detail">$schemaMap</a> <span style="color: #0000BB"></span><span style="color: #007700">=&nbsp;[</span><span style="color: #DD0000">'pgsql'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'yii\db\pgsql\Schema'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'mysqli'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'yii\db\mysql\Schema'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'mysql'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'yii\db\mysql\Schema'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'sqlite'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'yii\db\sqlite\Schema'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'sqlite2'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'yii\db\sqlite\Schema'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'sqlsrv'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'yii\db\mssql\Schema'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'oci'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'yii\db\oci\Schema'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'mssql'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'yii\db\mssql\Schema'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'dblib'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'yii\db\mssql\Schema'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'cubrid'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'yii\db\cubrid\Schema'</span><span style="color: #007700">]</span></div>


    <div class="detail-header h3" id="$serverRetryInterval-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$serverRetryInterval-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L313" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L313" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $serverRetryInterval        <span class="detail-header-tag small">
            public                                                property
                    </span>
    </div>

    <div class="doc-description">
        <p>The retry interval in seconds for dead servers listed in <a href="yii-db-connection.html#$masters-detail">$masters</a> and <a href="yii-db-connection.html#$slaves-detail">$slaves</a>.
This is used together with <a href="yii-db-connection.html#$serverStatusCache-detail">$serverStatusCache</a>.</p>

            </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.integer">integer</a></span> <a href="yii-db-connection.html#$serverRetryInterval-detail">$serverRetryInterval</a> <span style="color: #0000BB"></span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">600</span></div>


    <div class="detail-header h3" id="$serverStatusCache-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$serverStatusCache-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L308" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L308" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $serverStatusCache        <span class="detail-header-tag small">
            public                                                property
                    </span>
    </div>

    <div class="doc-description">
        <p>The cache object or the ID of the cache application component that is used to store
the health status of the DB servers specified in <a href="yii-db-connection.html#$masters-detail">$masters</a> and <a href="yii-db-connection.html#$slaves-detail">$slaves</a>.
This is used only when read/write splitting is enabled or <a href="yii-db-connection.html#$masters-detail">$masters</a> is not empty.</p>

            </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="yii-caching-cache.html">yii\caching\Cache</a>|<a href="http://www.php.net/language.types.string">string</a></span> <a href="yii-db-connection.html#$serverStatusCache-detail">$serverStatusCache</a> <span style="color: #0000BB"></span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'cache'</span></div>


    <div class="detail-header h3" id="$slave-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$slave-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $slave        <span class="detail-header-tag small">
            public                         <em>read-only</em>                         property
                    </span>
    </div>

    <div class="doc-description">
        <p>The currently active slave connection. Null is returned if there is slave available and
<code>$fallbackToMaster</code> is false.</p>

            </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="yii-db-connection.html">yii\db\Connection</a></span> <strong><a href="yii-db-connection.html#getSlave()-detail">getSlave</a></strong> ( <span style="color: #0000BB">$fallbackToMaster&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">true</span> )</div>


    <div class="detail-header h3" id="$slaveConfig-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$slaveConfig-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L342" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L342" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $slaveConfig        <span class="detail-header-tag small">
            public                                                property
                    </span>
    </div>

    <div class="doc-description">
        <p>The configuration that should be merged with every slave configuration listed in <a href="yii-db-connection.html#$slaves-detail">$slaves</a>.
For example,</p>
<pre><code class="hljs php language-php">[
    <span class="hljs-string">'username'</span> =&gt; <span class="hljs-string">'slave'</span>,
    <span class="hljs-string">'password'</span> =&gt; <span class="hljs-string">'slave'</span>,
    <span class="hljs-string">'attributes'</span> =&gt; [
        <span class="hljs-comment">// use a smaller connection timeout</span>
        PDO::ATTR_TIMEOUT =&gt; <span class="hljs-number">10</span>,
    ],
]
</code></pre>

            </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.array">array</a></span> <a href="yii-db-connection.html#$slaveConfig-detail">$slaveConfig</a> <span style="color: #0000BB"></span><span style="color: #007700">=&nbsp;[]</span></div>


    <div class="detail-header h3" id="$slavePdo-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$slavePdo-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $slavePdo        <span class="detail-header-tag small">
            public                         <em>read-only</em>                         property
                    </span>
    </div>

    <div class="doc-description">
        <p>The PDO instance for the currently active slave connection. Null is returned if no slave connection
is available and <code>$fallbackToMaster</code> is false.</p>

            </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/class.pdo">PDO</a></span> <strong><a href="yii-db-connection.html#getSlavePdo()-detail">getSlavePdo</a></strong> ( <span style="color: #0000BB">$fallbackToMaster&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">true</span> )</div>


    <div class="detail-header h3" id="$slaves-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$slaves-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L326" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L326" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $slaves        <span class="detail-header-tag small">
            public                                                property
                    </span>
    </div>

    <div class="doc-description">
        <p>List of slave connection configurations. Each configuration is used to create a slave DB connection.
When <a href="yii-db-connection.html#$enableSlaves-detail">$enableSlaves</a> is true, one of these configurations will be chosen and used to create a DB connection
for performing read queries only.</p>

        <p>See also:</p><ul><li><a href="yii-db-connection.html#$enableSlaves-detail">$enableSlaves</a></li><li><a href="yii-db-connection.html#$slaveConfig-detail">$slaveConfig</a></li></ul>    </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.array">array</a></span> <a href="yii-db-connection.html#$slaves-detail">$slaves</a> <span style="color: #0000BB"></span><span style="color: #007700">=&nbsp;[]</span></div>


    <div class="detail-header h3" id="$tablePrefix-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$tablePrefix-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L263" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L263" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $tablePrefix        <span class="detail-header-tag small">
            public                                                property
                    </span>
    </div>

    <div class="doc-description">
        <p>The common prefix or suffix for table names. If a table name is given
as <code>{{%TableName}}</code>, then the percentage character <code>%</code> will be replaced with this
property value. For example, <code>{{%post}}</code> becomes <code>{{tbl_post}}</code>.</p>

            </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.string">string</a></span> <a href="yii-db-connection.html#$tablePrefix-detail">$tablePrefix</a> <span style="color: #0000BB"></span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">''</span></div>


    <div class="detail-header h3" id="$transaction-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$transaction-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $transaction        <span class="detail-header-tag small">
            public                         <em>read-only</em>                         property
                    </span>
    </div>

    <div class="doc-description">
        <p>The currently active transaction. Null if no active transaction.</p>

            </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="yii-db-transaction.html">yii\db\Transaction</a></span> <strong><a href="yii-db-connection.html#getTransaction()-detail">getTransaction</a></strong> ( )</div>


    <div class="detail-header h3" id="$username-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#$username-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L166" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L166" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        $username        <span class="detail-header-tag small">
            public                                                property
                    </span>
    </div>

    <div class="doc-description">
        <p>The username for establishing DB connection. Defaults to <code>null</code> meaning no username to use.</p>

            </div>

    <div class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.string">string</a></span> <a href="yii-db-connection.html#$username-detail">$username</a> <span style="color: #0000BB"></span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">null</span></div>

</div>
<h2>Method Details</h2>

<div class="method-doc">

    <div class="detail-header h3" id="__sleep()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#__sleep()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L969" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L969" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        __sleep()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Close the connection before serializing.</strong></p>

        
            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.array">array</a></span> <strong><a href="yii-db-connection.html#__sleep()-detail">__sleep</a></strong> ( )</td></tr>
            </table>

<!--	-->

    <div class="detail-header h3" id="beginTransaction()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#beginTransaction()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L657" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L657" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        beginTransaction()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Starts a transaction.</strong></p>

        
            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="yii-db-transaction.html">yii\db\Transaction</a></span> <strong><a href="yii-db-connection.html#beginTransaction()-detail">beginTransaction</a></strong> ( <span style="color: #0000BB">$isolationLevel&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">null</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$isolationLevel</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.string">string</a>|<a href="http://www.php.net/language.types.null">null</a></td>
                  <td class="param-desc-col"><p>The isolation level to use for this transaction.
See <a href="yii-db-transaction.html#begin()-detail">yii\db\Transaction::begin()</a> for details.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="yii-db-transaction.html">yii\db\Transaction</a></td>
                  <td class="param-desc-col"><p>The transaction initiated</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="cache()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#cache()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L429" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L429" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        cache()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Uses query cache for the queries performed with the callable.</strong></p>

        <p>When query caching is enabled (<a href="yii-db-connection.html#$enableQueryCache-detail">$enableQueryCache</a> is true and <a href="yii-db-connection.html#$queryCache-detail">$queryCache</a> refers to a valid cache),
queries performed within the callable will be cached and their results will be fetched from cache if available.
For example,</p>
<pre><code class="hljs php language-php"><span class="hljs-comment">// The customer will be fetched from cache if available.</span>
<span class="hljs-comment">// If not, the query will be made against DB and cached for use next time.</span>
<span class="hljs-variable">$customer</span> = <span class="hljs-variable">$db</span>-&gt;cache(<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-params">(Connection <span class="hljs-variable">$db</span>)</span> </span>{
    <span class="hljs-keyword">return</span> <span class="hljs-variable">$db</span>-&gt;createCommand(<span class="hljs-string">'SELECT * FROM customer WHERE id=1'</span>)-&gt;queryOne();
});
</code></pre>
<p>Note that query cache is only meaningful for queries that return results. For queries performed with
<a href="yii-db-command.html#execute()-detail">yii\db\Command::execute()</a>, query cache will not be used.</p>

        <p>See also:</p><ul><li><a href="yii-db-connection.html#$enableQueryCache-detail">$enableQueryCache</a></li><li><a href="yii-db-connection.html#$queryCache-detail">$queryCache</a></li><li><a href="yii-db-connection.html#noCache()-detail">noCache()</a></li></ul>    </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type">mixed</span> <strong><a href="yii-db-connection.html#cache()-detail">cache</a></strong> ( <span class="signature-type"><a href="http://www.php.net/language.types.callable">callable</a></span> <span style="color: #0000BB">$callable</span>, <span style="color: #0000BB">$duration&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">null</span>, <span style="color: #0000BB">$dependency&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">null</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$callable</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.callable">callable</a></td>
                  <td class="param-desc-col"><p>A PHP callable that contains DB queries which will make use of query cache.
The signature of the callable is <code>function (Connection $db)</code>.</p>
</td>
                </tr>
                            <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$duration</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.integer">integer</a></td>
                  <td class="param-desc-col"><p>The number of seconds that query results can remain valid in the cache. If this is
not set, the value of <a href="yii-db-connection.html#$queryCacheDuration-detail">$queryCacheDuration</a> will be used instead.
Use 0 to indicate that the cached data will never expire.</p>
</td>
                </tr>
                            <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$dependency</span></td>
                  <td class="param-type-col"><a href="yii-caching-dependency.html">yii\caching\Dependency</a></td>
                  <td class="param-desc-col"><p>The cache dependency associated with the cached query results.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col">mixed</td>
                  <td class="param-desc-col"><p>The return result of the callable</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">throws</th>
                  <td class="param-type-col"><a href="http://www.php.net/class.exception">Exception</a></td>
                  <td class="param-desc-col"><p>if there is any exception during query</p>
</td>
                </tr>
                        </table>

<!--	-->

    <div class="detail-header h3" id="close()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#close()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L558" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L558" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        close()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Closes the currently active DB connection.</strong></p>

        <p>It does nothing if the connection is already closed.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type">void</span> <strong><a href="yii-db-connection.html#close()-detail">close</a></strong> ( )</td></tr>
            </table>

<!--	-->

    <div class="detail-header h3" id="createCommand()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#createCommand()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L631" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L631" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        createCommand()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Creates a command for execution.</strong></p>

        
            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="yii-db-command.html">yii\db\Command</a></span> <strong><a href="yii-db-connection.html#createCommand()-detail">createCommand</a></strong> ( <span style="color: #0000BB">$sql&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">null</span>, <span style="color: #0000BB">$params&nbsp;</span><span style="color: #007700">=&nbsp;[]</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$sql</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.string">string</a></td>
                  <td class="param-desc-col"><p>The SQL statement to be executed</p>
</td>
                </tr>
                            <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$params</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>The parameters to be bound to the SQL statement</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="yii-db-command.html">yii\db\Command</a></td>
                  <td class="param-desc-col"><p>The DB command</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="createPdoInstance()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#createPdoInstance()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L580" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L580" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        createPdoInstance()
        <span class="detail-header-tag small">
            protected                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Creates the PDO instance.</strong></p>

        <p>This method is called by <a href="yii-db-connection.html#open()-detail">open()</a> to establish a DB connection.
The default implementation will create a PHP PDO instance.
You may override this method if the default PDO needs to be adapted for certain DBMS.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">protected</span> <span class="signature-type"><a href="http://www.php.net/class.pdo">PDO</a></span> <strong><a href="yii-db-connection.html#createPdoInstance()-detail">createPdoInstance</a></strong> ( )</td></tr>
                                                <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/class.pdo">PDO</a></td>
                  <td class="param-desc-col"><p>The pdo instance</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="getDriverName()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#getDriverName()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L818" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L818" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        getDriverName()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Returns the name of the DB driver. Based on the the current <a href="yii-db-connection.html#$dsn-detail">$dsn</a>, in case it was not set explicitly
by an end user.</strong></p>

        
            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.string">string</a></span> <strong><a href="yii-db-connection.html#getDriverName()-detail">getDriverName</a></strong> ( )</td></tr>
                                                <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.string">string</a></td>
                  <td class="param-desc-col"><p>Name of the DB driver</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="getIsActive()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#getIsActive()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L395" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L395" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        getIsActive()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Returns a value indicating whether the DB connection is established.</strong></p>

        
            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.boolean">boolean</a></span> <strong><a href="yii-db-connection.html#getIsActive()-detail">getIsActive</a></strong> ( )</td></tr>
                                                <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.boolean">boolean</a></td>
                  <td class="param-desc-col"><p>Whether the DB connection is established</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="getLastInsertID()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#getLastInsertID()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L746" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L746" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        getLastInsertID()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Returns the ID of the last inserted row or sequence value.</strong></p>

        
        <p>See also <a href="http://www.php.net/manual/en/function.PDO-lastInsertId.php">http://www.php.net/manual/en/function.PDO-lastInsertId.php</a>.</p>    </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.string">string</a></span> <strong><a href="yii-db-connection.html#getLastInsertID()-detail">getLastInsertID</a></strong> ( <span style="color: #0000BB">$sequenceName&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">''</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$sequenceName</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.string">string</a></td>
                  <td class="param-desc-col"><p>Name of the sequence object (required by some DBMS)</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.string">string</a></td>
                  <td class="param-desc-col"><p>The row ID of the last row inserted, or the last value retrieved from the sequence object</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="getMasterPdo()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#getMasterPdo()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L862" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L862" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        getMasterPdo()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Returns the PDO instance for the currently active master connection.</strong></p>

        <p>This method will open the master DB connection and then return <a href="yii-db-connection.html#$pdo-detail">$pdo</a>.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/class.pdo">PDO</a></span> <strong><a href="yii-db-connection.html#getMasterPdo()-detail">getMasterPdo</a></strong> ( )</td></tr>
                                                <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/class.pdo">PDO</a></td>
                  <td class="param-desc-col"><p>The PDO instance for the currently active master connection.</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="getQueryBuilder()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#getQueryBuilder()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L724" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L724" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        getQueryBuilder()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Returns the query builder for the current DB connection.</strong></p>

        
            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="yii-db-querybuilder.html">yii\db\QueryBuilder</a></span> <strong><a href="yii-db-connection.html#getQueryBuilder()-detail">getQueryBuilder</a></strong> ( )</td></tr>
                                                <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="yii-db-querybuilder.html">yii\db\QueryBuilder</a></td>
                  <td class="param-desc-col"><p>The query builder for the current DB connection.</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="getQueryCacheInfo()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#getQueryCacheInfo()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L487" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L487" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        getQueryCacheInfo()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Returns the current query cache information.</strong></p>

        <p>This method is used internally by <a href="yii-db-command.html">yii\db\Command</a>.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.array">array</a></span> <strong><a href="yii-db-connection.html#getQueryCacheInfo()-detail">getQueryCacheInfo</a></strong> ( <span style="color: #0000BB">$duration</span>, <span style="color: #0000BB">$dependency</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$duration</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.integer">integer</a></td>
                  <td class="param-desc-col"><p>The preferred caching duration. If null, it will be ignored.</p>
</td>
                </tr>
                            <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$dependency</span></td>
                  <td class="param-type-col"><a href="yii-caching-dependency.html">yii\caching\Dependency</a></td>
                  <td class="param-desc-col"><p>The preferred caching dependency. If null, it will be ignored.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>The current query cache information, or null if query cache is not enabled.</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="getSchema()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#getSchema()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L703" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L703" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        getSchema()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Returns the schema information for the database opened by this connection.</strong></p>

        
            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="yii-db-schema.html">yii\db\Schema</a></span> <strong><a href="yii-db-connection.html#getSchema()-detail">getSchema</a></strong> ( )</td></tr>
                                                <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="yii-db-schema.html">yii\db\Schema</a></td>
                  <td class="param-desc-col"><p>The schema information for the database opened by this connection.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">throws</th>
                  <td class="param-type-col"><a href="yii-base-notsupportedexception.html">yii\base\NotSupportedException</a></td>
                  <td class="param-desc-col"><p>if there is no support for the current driver type</p>
</td>
                </tr>
                        </table>

<!--	-->

    <div class="detail-header h3" id="getSlave()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#getSlave()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L875" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L875" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        getSlave()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Returns the currently active slave connection.</strong></p>

        <p>If this method is called the first time, it will try to open a slave connection when <a href="yii-db-connection.html#$enableSlaves-detail">$enableSlaves</a> is true.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="yii-db-connection.html">yii\db\Connection</a></span> <strong><a href="yii-db-connection.html#getSlave()-detail">getSlave</a></strong> ( <span style="color: #0000BB">$fallbackToMaster&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">true</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$fallbackToMaster</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.boolean">boolean</a></td>
                  <td class="param-desc-col"><p>Whether to return a master connection in case there is no slave connection available.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="yii-db-connection.html">yii\db\Connection</a></td>
                  <td class="param-desc-col"><p>The currently active slave connection. Null is returned if there is slave available and
<code>$fallbackToMaster</code> is false.</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="getSlavePdo()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#getSlavePdo()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L847" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L847" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        getSlavePdo()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Returns the PDO instance for the currently active slave connection.</strong></p>

        <p>When <a href="yii-db-connection.html#$enableSlaves-detail">$enableSlaves</a> is true, one of the slaves will be used for read queries, and its PDO instance
will be returned by this method.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/class.pdo">PDO</a></span> <strong><a href="yii-db-connection.html#getSlavePdo()-detail">getSlavePdo</a></strong> ( <span style="color: #0000BB">$fallbackToMaster&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">true</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$fallbackToMaster</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.boolean">boolean</a></td>
                  <td class="param-desc-col"><p>Whether to return a master PDO in case none of the slave connections is available.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/class.pdo">PDO</a></td>
                  <td class="param-desc-col"><p>The PDO instance for the currently active slave connection. Null is returned if no slave connection
is available and <code>$fallbackToMaster</code> is false.</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="getTableSchema()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#getTableSchema()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L735" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L735" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        getTableSchema()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Obtains the schema information for the named table.</strong></p>

        
            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="yii-db-tableschema.html">yii\db\TableSchema</a></span> <strong><a href="yii-db-connection.html#getTableSchema()-detail">getTableSchema</a></strong> ( <span style="color: #0000BB">$name</span>, <span style="color: #0000BB">$refresh&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">false</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$name</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.string">string</a></td>
                  <td class="param-desc-col"><p>Table name.</p>
</td>
                </tr>
                            <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$refresh</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.boolean">boolean</a></td>
                  <td class="param-desc-col"><p>Whether to reload the table schema even if it is found in the cache.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="yii-db-tableschema.html">yii\db\TableSchema</a></td>
                  <td class="param-desc-col"><p>Table schema information. Null if the named table does not exist.</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="getTransaction()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#getTransaction()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L646" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L646" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        getTransaction()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Returns the currently active transaction.</strong></p>

        
            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="yii-db-transaction.html">yii\db\Transaction</a></span> <strong><a href="yii-db-connection.html#getTransaction()-detail">getTransaction</a></strong> ( )</td></tr>
                                                <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="yii-db-transaction.html">yii\db\Transaction</a></td>
                  <td class="param-desc-col"><p>The currently active transaction. Null if no active transaction.</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="initConnection()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#initConnection()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L613" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L613" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        initConnection()
        <span class="detail-header-tag small">
            protected                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Initializes the DB connection.</strong></p>

        <p>This method is invoked right after the DB connection is established.
The default implementation turns on <code>PDO::ATTR_EMULATE_PREPARES</code>
if <a href="yii-db-connection.html#$emulatePrepare-detail">$emulatePrepare</a> is true, and sets the database <a href="yii-db-connection.html#$charset-detail">$charset</a> if it is not empty.
It then triggers an <a href="yii-db-connection.html#EVENT_AFTER_OPEN-detail">EVENT_AFTER_OPEN</a> event.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">protected</span> <span class="signature-type">void</span> <strong><a href="yii-db-connection.html#initConnection()-detail">initConnection</a></strong> ( )</td></tr>
            </table>

<!--	-->

    <div class="detail-header h3" id="noCache()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#noCache()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L466" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L466" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        noCache()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Disables query cache temporarily.</strong></p>

        <p>Queries performed within the callable will not use query cache at all. For example,</p>
<pre><code class="hljs php language-php"><span class="hljs-variable">$db</span>-&gt;cache(<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-params">(Connection <span class="hljs-variable">$db</span>)</span> </span>{

    <span class="hljs-comment">// ... queries that use query cache ...</span>

    <span class="hljs-keyword">return</span> <span class="hljs-variable">$db</span>-&gt;noCache(<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-params">(Connection <span class="hljs-variable">$db</span>)</span> </span>{
        <span class="hljs-comment">// this query will not use query cache</span>
        <span class="hljs-keyword">return</span> <span class="hljs-variable">$db</span>-&gt;createCommand(<span class="hljs-string">'SELECT * FROM customer WHERE id=1'</span>)-&gt;queryOne();
    });
});
</code></pre>

        <p>See also:</p><ul><li><a href="yii-db-connection.html#$enableQueryCache-detail">$enableQueryCache</a></li><li><a href="yii-db-connection.html#$queryCache-detail">$queryCache</a></li><li><a href="yii-db-connection.html#cache()-detail">cache()</a></li></ul>    </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type">mixed</span> <strong><a href="yii-db-connection.html#noCache()-detail">noCache</a></strong> ( <span class="signature-type"><a href="http://www.php.net/language.types.callable">callable</a></span> <span style="color: #0000BB">$callable</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$callable</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.callable">callable</a></td>
                  <td class="param-desc-col"><p>A PHP callable that contains DB queries which should not use query cache.
The signature of the callable is <code>function (Connection $db)</code>.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col">mixed</td>
                  <td class="param-desc-col"><p>The return result of the callable</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">throws</th>
                  <td class="param-type-col"><a href="http://www.php.net/class.exception">Exception</a></td>
                  <td class="param-desc-col"><p>if there is any exception during query</p>
</td>
                </tr>
                        </table>

<!--	-->

    <div class="detail-header h3" id="open()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#open()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L522" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L522" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        open()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Establishes a DB connection.</strong></p>

        <p>It does nothing if a DB connection has already been established.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type">void</span> <strong><a href="yii-db-connection.html#open()-detail">open</a></strong> ( )</td></tr>
                                                            <tr>
                  <th class="param-name-col">throws</th>
                  <td class="param-type-col"><a href="yii-db-exception.html">yii\db\Exception</a></td>
                  <td class="param-desc-col"><p>if connection fails</p>
</td>
                </tr>
                        </table>

<!--	-->

    <div class="detail-header h3" id="openFromPool()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#openFromPool()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L921" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L921" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        openFromPool()
        <span class="detail-header-tag small">
            protected                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Opens the connection to a server in the pool.</strong></p>

        <p>This method implements the load balancing among the given list of the servers.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">protected</span> <span class="signature-type"><a href="yii-db-connection.html">yii\db\Connection</a></span> <strong><a href="yii-db-connection.html#openFromPool()-detail">openFromPool</a></strong> ( <span class="signature-type"><a href="http://www.php.net/language.types.array">array</a></span> <span style="color: #0000BB">$pool</span>, <span class="signature-type"><a href="http://www.php.net/language.types.array">array</a></span> <span style="color: #0000BB">$sharedConfig</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$pool</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>The list of connection configurations in the server pool</p>
</td>
                </tr>
                            <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$sharedConfig</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.array">array</a></td>
                  <td class="param-desc-col"><p>The configuration common to those given in <code>$pool</code>.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="yii-db-connection.html">yii\db\Connection</a></td>
                  <td class="param-desc-col"><p>The opened DB connection, or null if no server is available</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">throws</th>
                  <td class="param-type-col"><a href="yii-base-invalidconfigexception.html">yii\base\InvalidConfigException</a></td>
                  <td class="param-desc-col"><p>if a configuration does not specify "dsn"</p>
</td>
                </tr>
                        </table>

<!--	-->

    <div class="detail-header h3" id="quoteColumnName()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#quoteColumnName()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L784" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L784" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        quoteColumnName()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Quotes a column name for use in a query.</strong></p>

        <p>If the column name contains prefix, the prefix will also be properly quoted.
If the column name is already quoted or contains special characters including '(', '[[' and '{{',
then this method will do nothing.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.string">string</a></span> <strong><a href="yii-db-connection.html#quoteColumnName()-detail">quoteColumnName</a></strong> ( <span style="color: #0000BB">$name</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$name</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.string">string</a></td>
                  <td class="param-desc-col"><p>Column name</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.string">string</a></td>
                  <td class="param-desc-col"><p>The properly quoted column name</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="quoteSql()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#quoteSql()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L798" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L798" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        quoteSql()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Processes a SQL statement by quoting table and column names that are enclosed within double brackets.</strong></p>

        <p>Tokens enclosed within double curly brackets are treated as table names, while
tokens enclosed within double square brackets are column names. They will be quoted accordingly.
Also, the percentage character "%" at the beginning or ending of a table name will be replaced
with <a href="yii-db-connection.html#$tablePrefix-detail">$tablePrefix</a>.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.string">string</a></span> <strong><a href="yii-db-connection.html#quoteSql()-detail">quoteSql</a></strong> ( <span style="color: #0000BB">$sql</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$sql</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.string">string</a></td>
                  <td class="param-desc-col"><p>The SQL to be quoted</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.string">string</a></td>
                  <td class="param-desc-col"><p>The quoted SQL</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="quoteTableName()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#quoteTableName()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L771" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L771" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        quoteTableName()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Quotes a table name for use in a query.</strong></p>

        <p>If the table name contains schema prefix, the prefix will also be properly quoted.
If the table name is already quoted or contains special characters including '(', '[[' and '{{',
then this method will do nothing.</p>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.string">string</a></span> <strong><a href="yii-db-connection.html#quoteTableName()-detail">quoteTableName</a></strong> ( <span style="color: #0000BB">$name</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$name</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.string">string</a></td>
                  <td class="param-desc-col"><p>Table name</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.string">string</a></td>
                  <td class="param-desc-col"><p>The properly quoted table name</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="quoteValue()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#quoteValue()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L758" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L758" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        quoteValue()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Quotes a string value for use in a query.</strong></p>

        <p>Note that if the parameter is not a string, it will be returned without change.</p>

        <p>See also <a href="http://www.php.net/manual/en/function.PDO-quote.php">http://www.php.net/manual/en/function.PDO-quote.php</a>.</p>    </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type"><a href="http://www.php.net/language.types.string">string</a></span> <strong><a href="yii-db-connection.html#quoteValue()-detail">quoteValue</a></strong> ( <span style="color: #0000BB">$value</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$value</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.string">string</a></td>
                  <td class="param-desc-col"><p>String to be quoted</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.string">string</a></td>
                  <td class="param-desc-col"><p>The properly quoted string</p>
</td>
                </tr>
                                    </table>

<!--	-->

    <div class="detail-header h3" id="setDriverName()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#setDriverName()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L834" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L834" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        setDriverName()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Changes the current driver name.</strong></p>

        
            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type">void</span> <strong><a href="yii-db-connection.html#setDriverName()-detail">setDriverName</a></strong> ( <span style="color: #0000BB">$driverName</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$driverName</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.string">string</a></td>
                  <td class="param-desc-col"><p>Name of the DB driver</p>
</td>
                </tr>
                                                </table>

<!--	-->

    <div class="detail-header h3" id="transaction()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#transaction()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L678" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L678" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        transaction()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Executes callback provided in a transaction.</strong></p>

        
            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type">mixed</span> <strong><a href="yii-db-connection.html#transaction()-detail">transaction</a></strong> ( <span class="signature-type"><a href="http://www.php.net/language.types.callable">callable</a></span> <span style="color: #0000BB">$callback</span>, <span style="color: #0000BB">$isolationLevel&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">null</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$callback</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.callable">callable</a></td>
                  <td class="param-desc-col"><p>A valid PHP callback that performs the job. Accepts connection instance as parameter.</p>
</td>
                </tr>
                            <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$isolationLevel</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.string">string</a>|<a href="http://www.php.net/language.types.null">null</a></td>
                  <td class="param-desc-col"><p>The isolation level to use for this transaction.
See <a href="yii-db-transaction.html#begin()-detail">yii\db\Transaction::begin()</a> for details.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col">mixed</td>
                  <td class="param-desc-col"><p>Result of callback function</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">throws</th>
                  <td class="param-type-col"><a href="http://www.php.net/class.exception">Exception</a></td>
                  <td class="param-desc-col"></td>
                </tr>
                        </table>

<!--	-->

    <div class="detail-header h3" id="useMaster()-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#useMaster()-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L904" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L904" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        useMaster()
        <span class="detail-header-tag small">
            public                                    method
                    </span>
    </div>

    <div class="doc-description">
        <p><strong>Executes the provided callback by using the master connection.</strong></p>

        <p>This method is provided so that you can temporarily force using the master connection to perform
DB operations even if they are read queries. For example,</p>
<pre><code class="hljs php language-php"><span class="hljs-variable">$result</span> = <span class="hljs-variable">$db</span>-&gt;useMaster(<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-params">(<span class="hljs-variable">$db</span>)</span> </span>{
    <span class="hljs-keyword">return</span> <span class="hljs-variable">$db</span>-&gt;createCommand(<span class="hljs-string">'SELECT * FROM user LIMIT 1'</span>)-&gt;queryOne();
});
</code></pre>

            </div>

    <table class="detail-table table table-striped table-bordered table-hover">
        <tr><td colspan="3" class="signature"><span class="signature-defs">public</span> <span class="signature-type">mixed</span> <strong><a href="yii-db-connection.html#useMaster()-detail">useMaster</a></strong> ( <span class="signature-type"><a href="http://www.php.net/language.types.callable">callable</a></span> <span style="color: #0000BB">$callback</span> )</td></tr>
                                    <tr>
                  <td class="param-name-col"><span style="color: #0000BB">$callback</span></td>
                  <td class="param-type-col"><a href="http://www.php.net/language.types.callable">callable</a></td>
                  <td class="param-desc-col"><p>A PHP callable to be executed by this method. Its signature is
<code>function (Connection $db)</code>. Its return value will be returned by this method.</p>
</td>
                </tr>
                                        <tr>
                  <th class="param-name-col">return</th>
                  <td class="param-type-col">mixed</td>
                  <td class="param-desc-col"><p>The return value of the callback</p>
</td>
                </tr>
                                    </table>

<!--	-->
</div>
    <h2>Event Details</h2>

<div class="event-doc">
    <div class="detail-header h3" id="EVENT_AFTER_OPEN-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#EVENT_AFTER_OPEN-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L138" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L138" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        EVENT_AFTER_OPEN        <span class="detail-header-tag small">
        event
        of type \yii\db\Event                </span>
    </div>

    <div class="doc-description">
        <p>An event that is triggered after a DB connection is established</p>

            </div>

    <div class="detail-header h3" id="EVENT_BEGIN_TRANSACTION-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#EVENT_BEGIN_TRANSACTION-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L142" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L142" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        EVENT_BEGIN_TRANSACTION        <span class="detail-header-tag small">
        event
        of type \yii\db\Event                </span>
    </div>

    <div class="doc-description">
        <p>An event that is triggered right before a top-level transaction is started</p>

            </div>

    <div class="detail-header h3" id="EVENT_COMMIT_TRANSACTION-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#EVENT_COMMIT_TRANSACTION-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L146" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L146" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        EVENT_COMMIT_TRANSACTION        <span class="detail-header-tag small">
        event
        of type \yii\db\Event                </span>
    </div>

    <div class="doc-description">
        <p>An event that is triggered right after a top-level transaction is committed</p>

            </div>

    <div class="detail-header h3" id="EVENT_ROLLBACK_TRANSACTION-detail">
        <a href="#" class="tool-link" title="go to top"><span class="glyphicon glyphicon-arrow-up"></span></a>
        <a class="tool-link hash" href="yii-db-connection.html#EVENT_ROLLBACK_TRANSACTION-detail" title="direct link to this method"><span class="glyphicon icon-hash"></span></a>
                    <a href="https://github.com/yiisoft/yii2/edit/master/framework/db/Connection.php#L150" class="tool-link" title="edit on github"><span class="glyphicon glyphicon-pencil"></span></a>
            <a href="https://github.com/yiisoft/yii2/blob/master/framework/db/Connection.php#L150" class="tool-link" title="view source on github"><span class="glyphicon glyphicon-eye-open"></span></a>
        
        EVENT_ROLLBACK_TRANSACTION        <span class="detail-header-tag small">
        event
        of type \yii\db\Event                </span>
    </div>

    <div class="doc-description">
        <p>An event that is triggered right after a top-level transaction is rolled back</p>

            </div>

</div>
    </div>
</div>

<script type="text/javascript">
    /*<![CDATA[*/
    $("a.toggle").on('click', function () {
        var $this = $(this);
        if ($this.hasClass('properties-hidden')) {
            $this.text($this.text().replace(/Show/,'Hide'));
            $this.parents(".summary").find(".inherited").show();
            $this.removeClass('properties-hidden');
        } else {
            $this.text($this.text().replace(/Hide/,'Show'));
            $this.parents(".summary").find(".inherited").hide();
            $this.addClass('properties-hidden');
        }

        return false;
    });
    /*
     $(".sourceCode a.show").toggle(function () {
     $(this).text($(this).text().replace(/show/,'hide'));
     $(this).parents(".sourceCode").find("div.code").show();
     },function () {
     $(this).text($(this).text().replace(/hide/,'show'));
     $(this).parents(".sourceCode").find("div.code").hide();
     });
     $("a.sourceLink").click(function () {
     $(this).attr('target','_blank');
     });
     */
    /*]]>*/
</script>


</div>

<footer class="footer">
        <p class="pull-right"><small>Page generated on Sat, 09 Jul 2016 12:15:49 +0000</small></p>
    Powered by <a href="http://www.yiiframework.com/" rel="external">Yii Framework</a></footer>

<script type="text/javascript">jQuery(document).ready(function () {
    var shiftWindow = function () { scrollBy(0, -50) };
    if (location.hash) setTimeout(shiftWindow, 1);
    window.addEventListener("hashchange", shiftWindow);
var element = document.createElement("script");
element.src = "./jssearch.index.js";
document.body.appendChild(element);

var searchBox = $('#searchbox');

// search when typing in search field
searchBox.on("keyup", function(event) {
    var query = $(this).val();

    if (query == '' || event.which == 27) {
        $('#search-resultbox').hide();
        return;
    } else if (event.which == 13) {
        var selectedLink = $('#search-resultbox a.selected');
        if (selectedLink.length != 0) {
            document.location = selectedLink.attr('href');
            return;
        }
    } else if (event.which == 38 || event.which == 40) {
        $('#search-resultbox').show();

        var selected = $('#search-resultbox a.selected');
        if (selected.length == 0) {
            $('#search-results').find('a').first().addClass('selected');
        } else {
            var next;
            if (event.which == 40) {
                next = selected.parent().next().find('a').first();
            } else {
                next = selected.parent().prev().find('a').first();
            }
            if (next.length != 0) {
                var resultbox = $('#search-results');
                var position = next.position();

//              TODO scrolling is buggy and jumps around
//                resultbox.scrollTop(Math.floor(position.top));
//                console.log(position.top);

                selected.removeClass('selected');
                next.addClass('selected');
            }
        }

        return;
    }
    $('#search-resultbox').show();
    $('#search-results').html('<li><span class="no-results">No results</span></li>');

    var result = jssearch.search(query);

    if (result.length > 0) {
        var i = 0;
        var resHtml = '';

        for (var key in result) {
            if (i++ > 20) {
                break;
            }
            resHtml = resHtml +
            '<li><a href="' + result[key].file.u.substr(3) +'"><span class="title">' + result[key].file.t + '</span>' +
            '<span class="description">' + result[key].file.d + '</span></a></li>';
        }
        $('#search-results').html(resHtml);
    }
});

// hide the search results on ESC
$(document).on("keyup", function(event) { if (event.which == 27) { $('#search-resultbox').hide(); } });
// hide search results on click to document
$(document).bind('click', function (e) { $('#search-resultbox').hide(); });
// except the following:
searchBox.bind('click', function(e) { e.stopPropagation(); });
$('#search-resultbox').bind('click', function(e) { e.stopPropagation(); });

});</script></body>
</html>
